1 |
commit: f7d28b1055bc515d9e510329c2840c1993f75654 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jan 19 19:08:44 2020 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 19 19:08:44 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f7d28b10 |
7 |
|
8 |
libq/tree: fix Coverity 206542 Resource leak |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
libq/tree.c | 3 +++ |
13 |
1 file changed, 3 insertions(+) |
14 |
|
15 |
diff --git a/libq/tree.c b/libq/tree.c |
16 |
index dc6ee61..c8ada5c 100644 |
17 |
--- a/libq/tree.c |
18 |
+++ b/libq/tree.c |
19 |
@@ -553,7 +553,10 @@ tree_next_pkg(tree_cat_ctx *cat_ctx) |
20 |
} while (ret == NULL); |
21 |
} else if (ctx->cachetype == CACHE_BINPKGS) { |
22 |
char *p = NULL; |
23 |
+ ret = NULL; |
24 |
do { |
25 |
+ if (ret != NULL) |
26 |
+ tree_close_pkg(ret); |
27 |
ret = tree_next_pkg_int(cat_ctx); |
28 |
} while (ret != NULL && (p = strstr(ret->name, ".tbz2")) == NULL); |
29 |
if (p != NULL) |