Skip to content

Commit

Permalink
libpriv: Remove unnecessary builder causing memory leak
Browse files Browse the repository at this point in the history
Remove the unnecessary builder causing memory leaks like this one:

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f60bd2fe3cf in __interceptor_malloc (/lib64/libasan.so.6+0xab3cf)
    coreos#1 0x7f60bca6cbb8 in g_malloc (/lib64/libglib-2.0.so.0+0x5bbb8)
    coreos#2 0x7f60bcaa54f2 in g_variant_type_copy (/lib64/libglib-2.0.so.0+0x944f2)
    coreos#3 0x7f60bcaa3384 in g_variant_builder_init (/lib64/libglib-2.0.so.0+0x92384)
    coreos#4 0x55e5bb3120d3 in filter_xattrs_cb src/libpriv/rpmostree-postprocess.cxx:1493
    coreos#5 0x7f60bc89cb38  (/lib64/libostree-1.so.1+0x49b38)
    coreos#6 0x7f60bc8a5e1a  (/lib64/libostree-1.so.1+0x52e1a)
    coreos#7 0x7f60bc8a622b in ostree_repo_write_dfd_to_mtree (/lib64/libostree-1.so.1+0x5322b)
    coreos#8 0x55e5bb307e6e in write_dfd_thread src/libpriv/rpmostree-postprocess.cxx:1551
    coreos#9 0x7f60bca92401  (/lib64/libglib-2.0.so.0+0x81401)
    coreos#10 0x7f60bc12d3f8 in start_thread (/lib64/libpthread.so.0+0x93f8)
    coreos#11 0x7f60bc05ab52 in __GI___clone (/lib64/libc.so.6+0x101b52)

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Apr 6, 2021
1 parent 1ec1a3a commit 9125b50
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/libpriv/rpmostree-postprocess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1489,13 +1489,9 @@ filter_xattrs_cb (OstreeRepo *repo,
{
g_assert (relpath);

GVariantBuilder builder;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ayay)"));

try {
return filter_xattrs_impl(repo, relpath, file_info, user_data);
} catch (std::exception& e) {
g_variant_builder_clear (&builder);
/* Unfortunately we have no way to throw from this callback */
g_printerr ("Failed to read xattrs of '%s': %s\n", relpath, e.what());
exit (1);
Expand Down

0 comments on commit 9125b50

Please sign in to comment.