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)
    #1 0x7f60bca6cbb8 in g_malloc (/lib64/libglib-2.0.so.0+0x5bbb8)
    #2 0x7f60bcaa54f2 in g_variant_type_copy (/lib64/libglib-2.0.so.0+0x944f2)
    #3 0x7f60bcaa3384 in g_variant_builder_init (/lib64/libglib-2.0.so.0+0x92384)
    #4 0x55e5bb3120d3 in filter_xattrs_cb src/libpriv/rpmostree-postprocess.cxx:1493
    #5 0x7f60bc89cb38  (/lib64/libostree-1.so.1+0x49b38)
    #6 0x7f60bc8a5e1a  (/lib64/libostree-1.so.1+0x52e1a)
    #7 0x7f60bc8a622b in ostree_repo_write_dfd_to_mtree (/lib64/libostree-1.so.1+0x5322b)
    #8 0x55e5bb307e6e in write_dfd_thread src/libpriv/rpmostree-postprocess.cxx:1551
    #9 0x7f60bca92401  (/lib64/libglib-2.0.so.0+0x81401)
    #10 0x7f60bc12d3f8 in start_thread (/lib64/libpthread.so.0+0x93f8)
    #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 9, 2021
1 parent 9af4e82 commit c1a8696
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/libpriv/rpmostree-postprocess.cxx
Expand Up @@ -1282,13 +1282,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 c1a8696

Please sign in to comment.