switchroot: Use g_new/g_free consistently
authorColin Walters <walters@verbum.org>
Fri, 25 Aug 2023 20:58:44 +0000 (16:58 -0400)
committerColin Walters <walters@verbum.org>
Fri, 25 Aug 2023 20:59:28 +0000 (16:59 -0400)
Coverity complains about this, even though they're the same thing.

src/libotcore/otcore-prepare-root.c
src/switchroot/ostree-prepare-root.c

index 189c2a1482d294510507627b968de49b45974135..f7523ef65e78e3cf28b9fad06249455fd6018846 100644 (file)
@@ -82,12 +82,12 @@ otcore_get_ostree_target (const char *cmdline, char **out_target, GError **error
     {
       if (strcmp (slot_suffix, "_a") == 0)
         {
-          *out_target = strdup (slot_a);
+          *out_target = g_strdup (slot_a);
           return TRUE;
         }
       else if (strcmp (slot_suffix, "_b") == 0)
         {
-          *out_target = strdup (slot_b);
+          *out_target = g_strdup (slot_b);
           return TRUE;
         }
       return glnx_throw (error, "androidboot.slot_suffix invalid: %s", slot_suffix);
@@ -98,7 +98,7 @@ otcore_get_ostree_target (const char *cmdline, char **out_target, GError **error
    */
   if (proc_cmdline_has_key_starting_with (cmdline, "androidboot."))
     {
-      *out_target = strdup (slot_a);
+      *out_target = g_strdup (slot_a);
       return TRUE;
     }
 
index 05cef49260464239b3d31a4d3447374312d26647..203722da2a015de8847732c8cbe9f6aa2ef6cc6c 100644 (file)
@@ -247,8 +247,8 @@ static void
 free_composefs_config (ComposefsConfig *config)
 {
   g_ptr_array_unref (config->pubkeys);
-  free (config->signature_pubkey);
-  free (config);
+  g_free (config->signature_pubkey);
+  g_free (config);
 }
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (ComposefsConfig, free_composefs_config)