diff --git a/src/libpriv/rpmostree-rpm-util.c b/src/libpriv/rpmostree-rpm-util.c index 58cd93b5..31bb57d8 100644 --- a/src/libpriv/rpmostree-rpm-util.c +++ b/src/libpriv/rpmostree-rpm-util.c @@ -320,14 +320,17 @@ rpmhdrs_new (RpmOstreeRefTs *refts, const GPtrArray *patterns) return ret; } -static void -rpmhdrs_free (struct RpmHeaders *l1) +void +rpmhdrs_free (struct RpmHeaders *hdrs) { - g_ptr_array_free (l1->hs, TRUE); - l1->hs = NULL; - rpmostree_refts_unref (l1->refts); + if (!hdrs) + return; - g_free (l1); + g_ptr_array_free (hdrs->hs, TRUE); + hdrs->hs = NULL; + rpmostree_refts_unref (hdrs->refts); + + g_free (hdrs); } static struct RpmHeadersDiff * diff --git a/src/libpriv/rpmostree-rpm-util.h b/src/libpriv/rpmostree-rpm-util.h index 74dcac78..45a7e9ee 100644 --- a/src/libpriv/rpmostree-rpm-util.h +++ b/src/libpriv/rpmostree-rpm-util.h @@ -38,6 +38,8 @@ struct RpmHeaders GPtrArray *hs; /* list of rpm header objects from = Header */ }; +typedef struct RpmHeaders RpmHeaders; + struct RpmHeadersDiff { GPtrArray *hs_add; /* list of rpm header objects from = Header */ @@ -91,6 +93,9 @@ const char *rpmrev_get_commit (struct RpmRevisionData *self); void rpmrev_free (struct RpmRevisionData *ptr); G_DEFINE_AUTOPTR_CLEANUP_FUNC(RpmRevisionData, rpmrev_free); +void rpmhdrs_free (RpmHeaders *hdrs); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(RpmHeaders, rpmhdrs_free); + RpmOstreeRefSack * rpmostree_get_refsack_for_commit (OstreeRepo *repo, const char *ref,