prepare-root: Fix crash if no keys were found
authorColin Walters <walters@verbum.org>
Fri, 9 Feb 2024 00:34:54 +0000 (19:34 -0500)
committerColin Walters <walters@verbum.org>
Fri, 9 Feb 2024 00:34:54 +0000 (19:34 -0500)
Handle a NULL pointer.

src/libotcore/otcore-prepare-root.c

index 12a85c080db4c729c3ec102784584f3c787d4c6c..42f92c912471799728dfffb8579908edc994f5b9 100644 (file)
@@ -147,7 +147,7 @@ otcore_load_config (int rootfs_fd, const char *filename, GError **error)
 void
 otcore_free_composefs_config (ComposefsConfig *config)
 {
-  g_ptr_array_unref (config->pubkeys);
+  g_clear_pointer (&config->pubkeys, g_ptr_array_unref);
   g_free (config->signature_pubkey);
   g_free (config);
 }