Skip to content

Commit

Permalink
daemon/core: Fix leaks in metadata cleanup
Browse files Browse the repository at this point in the history
I noticed I had `/tmp/rpmostree-metadata*` directories, and there
were two cases where we created those dirs.  Astonishingly,
*both* had bugs that prevented cleaning up.

Rename one of them so in the future it'll be clearer which is buggy (or both).

Closes: #772
Approved by: jlebon
  • Loading branch information
cgwalters authored and rh-atomic-bot committed May 12, 2017
1 parent 96f7551 commit 3fae2ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/daemon/rpmostree-sysroot-upgrader.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ find_missing_pkgs_in_rpmdb (int rootfs_dfd,
{
glnx_unref_object OstreeRepo *pkgcache_repo = NULL;

if (!rpmostree_mkdtemp ("/tmp/rpmostree-metadata-XXXXXX",
if (!rpmostree_mkdtemp ("/tmp/rpmostree-localpkgmeta-XXXXXX",
&metadata_tmp_path, NULL, error))
goto out;

Expand Down Expand Up @@ -631,12 +631,10 @@ find_missing_pkgs_in_rpmdb (int rootfs_dfd,
}

*out_missing_pkgs = g_steal_pointer (&missing_pkgs);
return TRUE;

ret = TRUE;
out:
if (metadata_tmp_path)
glnx_shutil_rm_rf_at (AT_FDCWD, metadata_tmp_path, cancellable, error);
(void) glnx_shutil_rm_rf_at (AT_FDCWD, metadata_tmp_path, NULL, NULL);
return ret;
}

Expand Down
2 changes: 0 additions & 2 deletions src/libpriv/rpmostree-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ rpmostree_context_finalize (GObject *object)

g_clear_pointer (&rctx->passwd_dir, g_free);

g_clear_pointer (&rctx->metadata_dir_path, g_free);

if (rctx->metadata_dir_path)
{
(void) glnx_shutil_rm_rf_at (AT_FDCWD, rctx->metadata_dir_path, NULL, NULL);
Expand Down

0 comments on commit 3fae2ea

Please sign in to comment.