commit:     5afabfc0042833b548309a918ad84bbdebfefd05
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 29 02:13:43 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Dec 29 02:13:43 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5afabfc0

qtbz2: fix leakage of dir_fd via the -d option

 qtbz2.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/qtbz2.c b/qtbz2.c
index 723ad27..3c2e9f0 100644
--- a/qtbz2.c
+++ b/qtbz2.c
@@ -353,9 +353,14 @@ int qtbz2_main(int argc, char **argv)
                        warn("Could not decompose '%s'", tbz2);
        }
 
+       /* We have to cleanup all resources as we're used indirectly
+        * (e.g. via qmerge).
+        */
        free(heap_tbz2);
        free(heap_xpak);
        free(heap_tarbz2);
+       if (dir_fd != AT_FDCWD)
+               close(dir_fd);
 
        return EXIT_SUCCESS;
 }

Reply via email to