aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2024-06-28 21:51:22 +0200
committerFabian Groffen <grobian@gentoo.org>2024-06-28 21:51:22 +0200
commit40f8fab17e2cb24ada3ef396248df644ca34d671 (patch)
tree5ef8094b5a80c59aec4d5200e03efdb49d93cbfe
parent*: remove i18n/gettext support (diff)
downloadportage-utils-40f8fab17e2cb24ada3ef396248df644ca34d671.tar.gz
portage-utils-40f8fab17e2cb24ada3ef396248df644ca34d671.tar.bz2
portage-utils-40f8fab17e2cb24ada3ef396248df644ca34d671.zip
fix Coverity issues
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--qdepends.c1
-rw-r--r--qmanifest.c8
-rw-r--r--qpkg.c4
3 files changed, 7 insertions, 6 deletions
diff --git a/qdepends.c b/qdepends.c
index 1ecfab5..6afcb1c 100644
--- a/qdepends.c
+++ b/qdepends.c
@@ -416,6 +416,7 @@ int qdepends_main(int argc, char **argv)
array_for_each(overlays, n, overlay) {
t = tree_open(portroot, overlay);
if (t != NULL) {
+ state.rtree = NULL;
if (state.resolve)
state.rtree = tree_open(portroot, overlay);
if (!(state.qmode & QMODE_REVERSE) && array_cnt(atoms) > 0) {
diff --git a/qmanifest.c b/qmanifest.c
index 5246fc4..555e3c7 100644
--- a/qmanifest.c
+++ b/qmanifest.c
@@ -1357,8 +1357,8 @@ verify_dir(
}
}
- while (dentrieslen-- > 0)
- free(dentries[dentrieslen]);
+ for (curdentry = 0; curdentry < dentrieslen; curdentry++)
+ free(dentries[curdentry]);
free(dentries);
#pragma omp parallel for shared(ret) private(entry, etpe, slash)
@@ -1497,8 +1497,8 @@ verify_manifest(
ret = verify_dir(dir, elems, elemslen, 0, buf + 2, msgs);
checked_manifests++;
- while (elemslen-- > 0)
- free(elems[elemslen]);
+ for (elemssize = 0; elemssize < elemslen; elemssize++)
+ free(elems[elemssize]);
free(elems);
return ret;
diff --git a/qpkg.c b/qpkg.c
index c165989..85dbbcf 100644
--- a/qpkg.c
+++ b/qpkg.c
@@ -101,9 +101,9 @@ qpkg_clean(char *dirp)
if (known_pkgs != NULL) {
/* check which binpkgs exist in the known_pkgs (vdb or trees), such
* that the remainder is what we would clean */
- array_for_each(bins, n, binatomstr) {
+ array_for_each_rev(bins, n, binatomstr) {
if (contains_set(binatomstr, known_pkgs))
- xarraydelete_ptr(bins, n--);
+ xarraydelete_ptr(bins, n);
}
free_set(known_pkgs);