repo: Ensure load_variant_if_exists sets NULL value
authorColin Walters <walters@verbum.org>
Tue, 30 Mar 2021 20:51:51 +0000 (20:51 +0000)
committerColin Walters <walters@verbum.org>
Sat, 3 Apr 2021 20:44:39 +0000 (16:44 -0400)
Spotted by @jlebon - we usually expect callers to zero, but
let's be explicit.

src/libostree/ostree-repo.c

index 40841c7bc65f2e8a1d2a064b9aa57e6175077ed9..b2347b47c76a218cc826588e92a0e834f0811a55 100644 (file)
@@ -3686,6 +3686,10 @@ load_metadata_internal (OstreeRepo       *self,
   g_return_val_if_fail (OSTREE_OBJECT_TYPE_IS_META (objtype), FALSE);
   g_return_val_if_fail (objtype == OSTREE_OBJECT_TYPE_COMMIT || out_state == NULL, FALSE);
 
+  /* Ensure this is set to NULL if we didn't find the object */
+  if (out_variant)
+    *out_variant = NULL;
+
   /* Special caching for dirmeta objects, since they're commonly referenced many
    * times.
    */