Skip to content

Commit

Permalink
libpriv/rpm-util: Fix cap_t leak
Browse files Browse the repository at this point in the history
Fixes c4ada85 ("libpriv: Stop digging in private libcap internals").
  • Loading branch information
jlebon committed Jan 30, 2024
1 parent 8a7b4ae commit eb0e7ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/libpriv/rpmostree-rpm-util.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1043,13 +1043,15 @@ rpmostree_print_transaction (DnfContext *dnfctx)
rpmostree_output_message ("Empty transaction");
}

G_DEFINE_AUTO_CLEANUP_FREE_FUNC (cap_t, cap_free, NULL)

GVariant *
rpmostree_fcap_to_ostree_xattr (const char *fcap, GError **error)
{
/* Unfortunately, libcap doesn't expose any APIs to get the raw xattr value.
* For now, we hackily dance around this by writting it out to a file and then
* re-reading from it. */
cap_t caps = cap_from_text (fcap);
g_auto (cap_t) caps = cap_from_text (fcap);

g_auto (GLnxTmpfile) tmpf = { 0 };
if (!glnx_open_anonymous_tmpfile (O_WRONLY | O_CLOEXEC, &tmpf, error))
Expand Down

0 comments on commit eb0e7ab

Please sign in to comment.