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: /
Date: Sun, 19 Jan 2020 19:36:16
Message-Id: 1579461284.6ac211da306deccd42717e05ebf132f3da61e053.grobian@gentoo
1 commit: 6ac211da306deccd42717e05ebf132f3da61e053
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 19 19:14:44 2020 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 19 19:14:44 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6ac211da
7
8 qpkg: fix Coverity 206541 Explicit null dereference
9
10 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
11
12 qpkg.c | 16 +++++++++-------
13 1 file changed, 9 insertions(+), 7 deletions(-)
14
15 diff --git a/qpkg.c b/qpkg.c
16 index 1eee7b1..419456c 100644
17 --- a/qpkg.c
18 +++ b/qpkg.c
19 @@ -96,14 +96,16 @@ qpkg_clean(char *dirp)
20 }
21 }
22
23 - /* check which binpkgs exist in the known_pkgs (vdb or trees), such
24 - * that the remainder is what we would clean */
25 - array_for_each(bins, n, binatomstr) {
26 - if (contains_set(binatomstr, known_pkgs))
27 - xarraydelete_ptr(bins, n--);
28 - }
29 + if (known_pkgs != NULL) {
30 + /* check which binpkgs exist in the known_pkgs (vdb or trees), such
31 + * that the remainder is what we would clean */
32 + array_for_each(bins, n, binatomstr) {
33 + if (contains_set(binatomstr, known_pkgs))
34 + xarraydelete_ptr(bins, n--);
35 + }
36
37 - free_set(known_pkgs);
38 + free_set(known_pkgs);
39 + }
40
41 array_for_each(bins, n, binatomstr) {
42 snprintf(buf, sizeof(buf), "%s/%s.tbz2", dirp, binatomstr);