diff options
author | 2024-06-28 21:51:22 +0200 | |
---|---|---|
committer | 2024-06-28 21:51:22 +0200 | |
commit | 40f8fab17e2cb24ada3ef396248df644ca34d671 (patch) | |
tree | 5ef8094b5a80c59aec4d5200e03efdb49d93cbfe | |
parent | *: remove i18n/gettext support (diff) | |
download | portage-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.c | 1 | ||||
-rw-r--r-- | qmanifest.c | 8 | ||||
-rw-r--r-- | qpkg.c | 4 |
3 files changed, 7 insertions, 6 deletions
@@ -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; @@ -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); |