commit: 24fdfe821889a2ff2d2b70861f2aefbc672f2355 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Sat Jan 10 10:04:59 2026 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Sat Jan 10 10:04:59 2026 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=24fdfe82
libq/set: do not just discard input array in array_set and values_set Just throwing away the pointer data may just cause a leak. The caller provides an array, so the caller should ensure it is empty, if the new values aren't supposed to be appended to existing data. Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> libq/set.c | 8 +------- qlop.c | 8 ++++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/libq/set.c b/libq/set.c index fa485c7..d865b63 100644 --- a/libq/set.c +++ b/libq/set.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2023 Gentoo Foundation + * Copyright 2005-2026 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 * * Copyright 2005-2010 Ned Ludd - <[email protected]> @@ -288,9 +288,6 @@ array_set(set *q, array_t *ret) { int i; set_elem *w; - array_t blank = array_init_decl; - - *ret = blank; /* allow using empty set */ if (q == NULL) @@ -309,9 +306,6 @@ values_set(set *q, array_t *ret) { int i; set_elem *w; - array_t blank = array_init_decl; - - *ret = blank; /* allow using empty set */ if (q == NULL) diff --git a/qlop.c b/qlop.c index 4c4ad36..3c584c3 100644 --- a/qlop.c +++ b/qlop.c @@ -517,12 +517,12 @@ static int do_emerge_log( * "valid" one, such that dummy emerge calls (e.g. * emerge -pv foo) are ignored */ if (last_merge != tstart_emerge) { - array_t vals; + DECLARE_ARRAY(vals); - values_set(atomset, &vals); - array_for_each(&vals, i, atomw) + values_set(atomset, vals); + array_for_each(vals, i, atomw) atom_implode(atomw); - xarrayfree_int(&vals); + xarrayfree_int(vals); clear_set(atomset); last_merge = tstart_emerge;
