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 14949139BC8 for ; Sun, 20 Sep 2015 08:15:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6664621C03C; Sun, 20 Sep 2015 08:15:31 +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 9EA3221C03C for ; Sun, 20 Sep 2015 08:15:30 +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 C3386340887 for ; Sun, 20 Sep 2015 08:15:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A3511205 for ; Sun, 20 Sep 2015 08:15:27 +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: <1442341289.98db340d61a9607ab179a5d4dc057cf453d90e55.vapier@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: libsandbox/ X-VCS-Repository: proj/sandbox X-VCS-Files: libsandbox/trace.c X-VCS-Directories: libsandbox/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 98db340d61a9607ab179a5d4dc057cf453d90e55 X-VCS-Branch: master Date: Sun, 20 Sep 2015 08:15:27 +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: dd09268d-006c-4813-8e4e-bc48a63487ff X-Archives-Hash: 56fcb1986c4438310ebf763953b516bd commit: 98db340d61a9607ab179a5d4dc057cf453d90e55 Author: Mike Frysinger gentoo org> AuthorDate: Tue Sep 15 18:21:29 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Tue Sep 15 18:21:29 2015 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=98db340d libsandbox: avoid leaking memory when extracting strings If userland supports process_vm_readv, but the kernel does not (newer kernel headers & C lib than kernel), then we leak a bit of memory when we fallback to the ptrace code. Do not re-allocate the ret buffer if the code does fallback. Signed-off-by: Mike Frysinger gentoo.org> libsandbox/trace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libsandbox/trace.c b/libsandbox/trace.c index dfbab18..1d40392 100644 --- a/libsandbox/trace.c +++ b/libsandbox/trace.c @@ -119,11 +119,12 @@ static char *do_peekstr(unsigned long lptr) ret = xrealloc(ret, len); liov.iov_base = ret + len - l; } +#else + len = 1024; + ret = xmalloc(len); #endif l = 0; - len = 1024; - ret = xmalloc(len); while (1) { a = lptr & (sizeof(long) - 1); lptr -= a;