From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1126113-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 1F24D138334
	for <garchives@archives.gentoo.org>; Fri, 29 Nov 2019 13:22:15 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 3277EE0207;
	Fri, 29 Nov 2019 13:22:14 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 14A08E0207
	for <gentoo-commits@lists.gentoo.org>; Fri, 29 Nov 2019 13:22:13 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id A8EDB34D586
	for <gentoo-commits@lists.gentoo.org>; Fri, 29 Nov 2019 13:22:12 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 6B4448AD
	for <gentoo-commits@lists.gentoo.org>; Fri, 29 Nov 2019 13:22:10 +0000 (UTC)
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" <grobian@gentoo.org>
Message-ID: <1575033626.8febe8d3aae1033a3e9a63793ab46053860d18cf.grobian@gentoo>
Subject: [gentoo-commits] proj/portage-utils:master commit in: /
X-VCS-Repository: proj/portage-utils
X-VCS-Files: main.c qsearch.c
X-VCS-Directories: /
X-VCS-Committer: grobian
X-VCS-Committer-Name: Fabian Groffen
X-VCS-Revision: 8febe8d3aae1033a3e9a63793ab46053860d18cf
X-VCS-Branch: master
Date: Fri, 29 Nov 2019 13:22:10 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 8ee66f29-48c1-4cf0-ac83-d32a4d09b7d0
X-Archives-Hash: 112e611ab57e3142eebb03c849f87591

commit:     8febe8d3aae1033a3e9a63793ab46053860d18cf
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 29 13:20:26 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Nov 29 13:20:26 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=8febe8d3

main/qsearch: plug some minor memleaks

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

 main.c    | 6 +++++-
 qsearch.c | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index 056e09c..1f20b38 100644
--- a/main.c
+++ b/main.c
@@ -510,8 +510,11 @@ read_portage_profile(const char *profile, env_vars vars[])
 	 * treat parent profiles as defaults, that can be overridden by
 	 * *this* profile. */
 	strcpy(profile_file + profile_len, "parent");
-	if (eat_file(profile_file, &buf, &buf_len) == 0)
+	if (eat_file(profile_file, &buf, &buf_len) == 0) {
+		if (buf != NULL)
+			free(buf);
 		return;
+	}
 
 	s = strtok_r(buf, "\n", &saveptr);
 	while (s) {
@@ -643,6 +646,7 @@ read_one_repos_conf(const char *repos_conf)
 				xarraypush_str(overlay_src, repos_conf);
 			}
 			if (main_repo && strcmp(repo, main_repo) == 0) {
+				free(main_overlay);
 				main_overlay = ele;
 				free(vars_to_read[11 /* PORTDIR */].src);
 				vars_to_read[11 /* PORTDIR */].src = xstrdup(repos_conf);

diff --git a/qsearch.c b/qsearch.c
index 8245383..d6470f6 100644
--- a/qsearch.c
+++ b/qsearch.c
@@ -187,5 +187,6 @@ int qsearch_main(int argc, char **argv)
 		}
 	}
 
+	regfree(&state.search_expr);
 	return ret;
 }