Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/
Date: Mon, 25 May 2020 11:20:56
Message-Id: 1590405578.74aeefacd106fcf87e755f2d1a53b0c7bc9f2e10.grobian@gentoo
1 commit: 74aeefacd106fcf87e755f2d1a53b0c7bc9f2e10
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Mon May 25 11:19:38 2020 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Mon May 25 11:19:38 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=74aeefac
7
8 libq/tree: fix Coverity 210534
9
10 tree_close_pkg can be called from tree_open_pkg, which will then free
11 the pointer de->d_name, which should only be freed by scandir_free.
12
13 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
14
15 libq/tree.c | 1 +
16 1 file changed, 1 insertion(+)
17
18 diff --git a/libq/tree.c b/libq/tree.c
19 index d313f3b..e4c4eb7 100644
20 --- a/libq/tree.c
21 +++ b/libq/tree.c
22 @@ -399,6 +399,7 @@ tree_open_pkg(tree_cat_ctx *cat_ctx, const char *name)
23 if (cat_ctx->ctx->query_atom != NULL) {
24 (void)tree_get_atom(pkg_ctx, cat_ctx->ctx->query_atom->SLOT != NULL);
25 if (atom_compare(pkg_ctx->atom, cat_ctx->ctx->query_atom) != EQUAL) {
26 + pkg_ctx->name = NULL;
27 tree_close_pkg(pkg_ctx);
28 return NULL;
29 }