From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id F27AD1388C2 for ; Thu, 17 Dec 2015 05:06:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E6384E0851; Thu, 17 Dec 2015 05:06:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 10667E084C for ; Thu, 17 Dec 2015 05:06:26 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E677233E3A9 for ; Thu, 17 Dec 2015 05:06:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 69588CB0 for ; Thu, 17 Dec 2015 05:06:21 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1450327518.dc82e50a316006d339eb0a4aa0d65a9502c41677.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: main.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: dc82e50a316006d339eb0a4aa0d65a9502c41677 X-VCS-Branch: master Date: Thu, 17 Dec 2015 05:06:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 89e7acc9-799f-4f79-a906-0ccf0c1fff79 X-Archives-Hash: d6bb0412ce327aa6d11313a4081aaa59 commit: dc82e50a316006d339eb0a4aa0d65a9502c41677 Author: Mike Frysinger gentoo org> AuthorDate: Thu Dec 17 04:45:18 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Thu Dec 17 04:45:18 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=dc82e50a cache: avoid memleak warnings We leak a bit of memory when reinitializing the caches, but we don't care because we'll be exiting soon after. Free the memory in debug builds. main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index c571ef7..d366bef 100644 --- a/main.c +++ b/main.c @@ -1071,15 +1071,19 @@ ret: void reinitialize_as_needed(void) { size_t n; - const char *overlay; + const char *overlay, *ret = ret; if (reinitialize) - array_for_each(overlays, n, overlay) - initialize_flat(overlay, CACHE_EBUILD, true); + array_for_each(overlays, n, overlay) { + ret = initialize_flat(overlay, CACHE_EBUILD, true); + IF_DEBUG(free((void *)ret)); + } if (reinitialize_metacache) - array_for_each(overlays, n, overlay) - initialize_flat(overlay, CACHE_METADATA, true); + array_for_each(overlays, n, overlay) { + ret = initialize_flat(overlay, CACHE_METADATA, true); + IF_DEBUG(free((void *)ret)); + } } typedef struct {