Skip to content

Commit

Permalink
Merge pull request #4811 from jlebon/pr/caps-leak
Browse files Browse the repository at this point in the history
libpriv/rpm-util: Fix cap_t leak
  • Loading branch information
jmarrero committed Jan 30, 2024
2 parents 8a7b4ae + eb0e7ab commit 76ab8c2
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 76ab8c2

Please sign in to comment.