commit:     3f07887498988fb202c02550813a008d43d3175f
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 26 18:09:28 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jan 26 18:09:28 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=3f078874

libq/tree: use computed atom in tree_foreach_pkg_gtree, CID 557233

Coverity actually saw the atom getting lost, but it was a mistake not to
use the atom in the created pkg, for it means the next lookup would have
to create one.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/tree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libq/tree.c b/libq/tree.c
index 34b82a11..4f88a53c 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -319,6 +319,7 @@ static int tree_foreach_pkg_gtree
       pkg = xzalloc(sizeof(*pkg));
       pkg->name = xstrdup(atom->PN);
       pkg->path = xstrdup(buf);
+      pkg->atom = atom;
       pkg->cat  = cat;
       array_append(cat->pkgs, pkg);
 
@@ -412,7 +413,9 @@ static int tree_foreach_pkg_gtree
       }
 
       pkg->meta_complete = true;
-    } else if (foundcaches) {
+    }
+    else if (foundcaches)
+    {
       break;  /* stop searching if we processed all cache entries */
     }
   }

Reply via email to