core: Fix up more nevra leaks

Really do need to make it `const` but let's do that separately.

Closes: #359
Approved by: jlebon
This commit is contained in:
Colin Walters 2016-06-29 02:13:26 -04:00 committed by Atomic Bot
parent 974d725f30
commit 462645e71c

View File

@ -1465,7 +1465,10 @@ ostree_checkout_package (OstreeRepo *repo,
ret = TRUE; ret = TRUE;
out: out:
if (error && *error) if (error && *error)
g_prefix_error (error, "Unpacking %s: ", hif_package_get_nevra (pkg)); {
g_autofree char *nevra = hif_package_get_nevra (pkg);
g_prefix_error (error, "Unpacking %s: ", nevra);
}
return ret; return ret;
} }
@ -1931,8 +1934,9 @@ get_header_for_package (int tmp_metadata_dfd,
{ {
Header hdr = NULL; Header hdr = NULL;
glnx_fd_close int metadata_fd = -1; glnx_fd_close int metadata_fd = -1;
g_autofree char *nevra = hif_package_get_nevra (pkg);
if ((metadata_fd = openat (tmp_metadata_dfd, hif_package_get_nevra (pkg), O_RDONLY | O_CLOEXEC)) < 0) if ((metadata_fd = openat (tmp_metadata_dfd, nevra, O_RDONLY | O_CLOEXEC)) < 0)
{ {
glnx_set_error_from_errno (error); glnx_set_error_from_errno (error);
return NULL; return NULL;
@ -2090,6 +2094,7 @@ rpmostree_context_assemble_commit (RpmOstreeContext *self,
g_autofree char *cached_rev = NULL; g_autofree char *cached_rev = NULL;
g_autoptr(GVariant) pkg_commit = NULL; g_autoptr(GVariant) pkg_commit = NULL;
g_autoptr(GVariant) header_variant = NULL; g_autoptr(GVariant) header_variant = NULL;
g_autofree char *nevra = hif_package_get_nevra (pkg);
{ {
g_autofree char *branch_head_rev = NULL; g_autofree char *branch_head_rev = NULL;
@ -2121,7 +2126,7 @@ rpmostree_context_assemble_commit (RpmOstreeContext *self,
goto out; goto out;
} }
if (!glnx_file_replace_contents_at (tmp_metadata_dfd, hif_package_get_nevra (pkg), if (!glnx_file_replace_contents_at (tmp_metadata_dfd, nevra,
g_variant_get_data (header_variant), g_variant_get_data (header_variant),
g_variant_get_size (header_variant), g_variant_get_size (header_variant),
GLNX_FILE_REPLACE_NODATASYNC, GLNX_FILE_REPLACE_NODATASYNC,