From eea777fae8a08f0e03aa1b48582e156a2e234763 Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Fri, 3 May 2024 16:21:16 +0100 Subject: [PATCH] udisks2: check if variables are NULL before calling unref Signed-off-by: Sergio Correia --- src/luks/udisks2/clevis-luks-udisks2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/luks/udisks2/clevis-luks-udisks2.c b/src/luks/udisks2/clevis-luks-udisks2.c index 3a520d59..be3c53f9 100644 --- a/src/luks/udisks2/clevis-luks-udisks2.c +++ b/src/luks/udisks2/clevis-luks-udisks2.c @@ -264,8 +264,10 @@ child_main(int sock) error: g_list_free_full(ctx.lst, g_free); - g_main_loop_unref(ctx.loop); - g_object_unref(ctx.clt); + if (ctx.loop) + g_main_loop_unref(ctx.loop); + if (ctx.clt) + g_object_unref(ctx.clt); close(sock); return exit_status; }