composefs: Avoid double unref
authorColin Walters <walters@verbum.org>
Fri, 16 Jun 2023 18:52:53 +0000 (14:52 -0400)
committerColin Walters <walters@verbum.org>
Sat, 17 Jun 2023 13:11:51 +0000 (09:11 -0400)
The interaction of `iter_loop` and autofree is way too subtle;
I happened to be reading this code and noticed we did the NULL
reset in one path but not another.

The real fix is Rust...

src/libostree/ostree-repo-composefs.c

index 330b0cf4958f51ece3035c75bfae3c5e3fc762e5..612890d0e8e1aa34a32a9f222ed1b7f6d5ed9cbd 100644 (file)
@@ -461,6 +461,9 @@ checkout_composefs_recurse (OstreeRepo *self, const char *dirtree_checksum,
                                          dname, cancellable, error))
           return FALSE;
       }
+    /* Freed by iter-loop */
+    subdirtree_csum_v = NULL;
+    subdirmeta_csum_v = NULL;
   }
 
   return TRUE;