1 |
commit: 5afabfc0042833b548309a918ad84bbdebfefd05 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Dec 29 02:13:43 2016 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Dec 29 02:13:43 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5afabfc0 |
7 |
|
8 |
qtbz2: fix leakage of dir_fd via the -d option |
9 |
|
10 |
qtbz2.c | 5 +++++ |
11 |
1 file changed, 5 insertions(+) |
12 |
|
13 |
diff --git a/qtbz2.c b/qtbz2.c |
14 |
index 723ad27..3c2e9f0 100644 |
15 |
--- a/qtbz2.c |
16 |
+++ b/qtbz2.c |
17 |
@@ -353,9 +353,14 @@ int qtbz2_main(int argc, char **argv) |
18 |
warn("Could not decompose '%s'", tbz2); |
19 |
} |
20 |
|
21 |
+ /* We have to cleanup all resources as we're used indirectly |
22 |
+ * (e.g. via qmerge). |
23 |
+ */ |
24 |
free(heap_tbz2); |
25 |
free(heap_xpak); |
26 |
free(heap_tarbz2); |
27 |
+ if (dir_fd != AT_FDCWD) |
28 |
+ close(dir_fd); |
29 |
|
30 |
return EXIT_SUCCESS; |
31 |
} |