util: Initialize sack pointer to NULL

Otherwise we'll be freeing uninitialized memory on error (this happened in CI
somehow).

Closes: #1246
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-02-13 16:51:14 -05:00 committed by Atomic Bot
parent 99aa6f89d2
commit 40b010a7ea

View File

@ -828,7 +828,7 @@ rpmostree_get_refsack_for_root (int dfd,
const char *path, const char *path,
GError **error) GError **error)
{ {
g_autoptr(DnfSack) sack; /* NB: refsack adds a ref to it */ g_autoptr(DnfSack) sack = NULL; /* NB: refsack adds a ref to it */
if (!get_sack_for_root (dfd, path, &sack, error)) if (!get_sack_for_root (dfd, path, &sack, error))
return NULL; return NULL;
return rpmostree_refsack_new (sack, NULL); return rpmostree_refsack_new (sack, NULL);