iface-modem-firmware: Initialize context to null

Without setting memory to NULL it is possible that ctx->list
point to an unitialized pointer and trig a segfault when we
free it (for example when the firmware list is not supported)

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
This commit is contained in:
Frederic Martinsons
2021-10-23 10:57:26 +02:00
parent c487ca1b36
commit 2ae5f3cc27

View File

@@ -160,7 +160,7 @@ handle_list (MmGdbusModemFirmware *skeleton,
{ {
HandleListContext *ctx; HandleListContext *ctx;
ctx = g_slice_new (HandleListContext); ctx = g_slice_new0 (HandleListContext);
ctx->skeleton = g_object_ref (skeleton); ctx->skeleton = g_object_ref (skeleton);
ctx->invocation = g_object_ref (invocation); ctx->invocation = g_object_ref (invocation);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);