commit:     4e090245684a5ca0357b1f692dee3bc403e8a476
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 24 11:14:22 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Jan 24 11:14:22 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4e090245

libq/tree: clear pointers in tree_pkg_meta when md5-cache was invalid

it actually happens that md5-cache is not valid, after which we will try
to read the ebuild, so clear the meta pointers after freeing them

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

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

diff --git a/libq/tree.c b/libq/tree.c
index f7f9d12..7dfaad4 100644
--- a/libq/tree.c
+++ b/libq/tree.c
@@ -1109,10 +1109,14 @@ char *tree_pkg_meta
             }
           }
 
+          IF_DEBUG(warn("%s/%s has invalid md5-cache entry",
+                        atom->CATEGORY, atom->PF));
+
           /* we read the meta, but apparently it was wrong, so clear
            * whatever we read */
           for (k = Q_UNKNOWN; k < TREE_META_MAX_KEYS; k++)
             free(pkg->meta[k]);
+          VAL_CLEAR(pkg->meta);
         }
 
         /* avoid trying to do this again */

Reply via email to