Message ID | 1507484146-23617-3-git-send-email-ulfalizer@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-kbuild-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4CCD860230 for <patchwork-linux-kbuild@patchwork.kernel.org>; Sun, 8 Oct 2017 17:37:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39761285E8 for <patchwork-linux-kbuild@patchwork.kernel.org>; Sun, 8 Oct 2017 17:37:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C85A28685; Sun, 8 Oct 2017 17:37:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C193E285E8 for <patchwork-linux-kbuild@patchwork.kernel.org>; Sun, 8 Oct 2017 17:37:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753475AbdJHRgt (ORCPT <rfc822;patchwork-linux-kbuild@patchwork.kernel.org>); Sun, 8 Oct 2017 13:36:49 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:47314 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751228AbdJHRgT (ORCPT <rfc822;linux-kbuild@vger.kernel.org>); Sun, 8 Oct 2017 13:36:19 -0400 Received: by mail-lf0-f67.google.com with SMTP id k40so5550120lfi.4; Sun, 08 Oct 2017 10:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dBfaJhqBM+SFNh/HOBBKn5aR4+beLkb2RNuqjyiaKck=; b=GKVf2x7tXugPJ1s1z67LADodtx3u4syOeydwofrSJYAkIIjLT564ipmXMFyn/Isr0O W5lnF5i5ZKk2QaSYj56Rx4yqsTa6nsfvxhAw6G6w3eQV23Pc56cL478tqOjsXAvun6mp rxSNnZeFBxYyJx9TwCJT3f8qRTBvabDAMBSnYQlo9toESdn819o3g+DKXCTFKT3PzTsP tGVVAbrt89oLnI1X4/nwo7knOk/8Pe1i7Wu0wxvTl5m8mXStZV9GhN0jJTpHoRSGXc35 qNAH4jOLy1GwdWS3v3yblqedKwIt1EceYi83ds+wl0Tg91kvHEPgoxRQUuuTWkQF0mTb lxQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dBfaJhqBM+SFNh/HOBBKn5aR4+beLkb2RNuqjyiaKck=; b=GZD2PICDUABgMjj25TuxVt2IIt+KKWhzIUUnHcbk4w/HSy9YSF9kUVbBlJRAdvp1o6 OmlTKOIjhyv7hdKMeN9Lt7oakudW2ov4VArsoOGaNvAfiruwMO0v3ID+IQ460fk7Q4IN S/DyiL5AY8biDUTRz+K97vVGWHRB9uZ0AfNIft5NF11XyA82wiq8aOGrK1jKIlV7pCok Ls8oc9Ywm1LqTI2svei29bBWZG9lChf+gjdM++67VldbBDjES3ZPAE6LN1ef73AHSWIJ VbFQ648JoQRXC3fi3c2UztkEg/Tbc54UeJ9Yv+Zf0knr6FCStykkiHOIms9cZhiyqjL7 kJ1g== X-Gm-Message-State: AMCzsaVl0C3lpjyIzfu8Qrsgmst/g9EmS1H4hT9sGnchSWoMIzSJYW52 OgRBN8d+mHfCtUX8fX3+SgE= X-Google-Smtp-Source: AOwi7QCSJ2pfaWQX7/c02yvuqviHMuIjUuLsUC2fhvvKoOpGkEy1r1pnuMMzY3F8pvzs014/d20uZg== X-Received: by 10.25.81.146 with SMTP id g18mr3062578lfl.77.1507484177581; Sun, 08 Oct 2017 10:36:17 -0700 (PDT) Received: from huvuddator.lan (ua-213-112-0-22.cust.bredbandsbolaget.se. [213.112.0.22]) by smtp.gmail.com with ESMTPSA id h14sm1046428lfe.30.2017.10.08.10.36.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Oct 2017 10:36:16 -0700 (PDT) From: Ulf Magnusson <ulfalizer@gmail.com> To: yann.morin.1998@free.fr, linux-kbuild@vger.kernel.org Cc: sam@ravnborg.org, zippel@linux-m68k.org, nicolas.pitre@linaro.org, michal.lkml@markovi.net, dirk@gouders.net, yamada.masahiro@socionext.com, lacombar@gmail.com, walch.martin@web.de, JBeulich@suse.com, linux-kernel@vger.kernel.org, Ulf Magnusson <ulfalizer@gmail.com> Subject: [PATCH 2/3] kconfig: Fix expr_free() E_NOT leak Date: Sun, 8 Oct 2017 19:35:45 +0200 Message-Id: <1507484146-23617-3-git-send-email-ulfalizer@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507484146-23617-1-git-send-email-ulfalizer@gmail.com> References: <1507484146-23617-1-git-send-email-ulfalizer@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kbuild.vger.kernel.org> X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index cbf4996..ed29bad 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -113,7 +113,7 @@ void expr_free(struct expr *e) break; case E_NOT: expr_free(e->left.expr); - return; + break; case E_EQUAL: case E_GEQ: case E_GTH:
Only the E_NOT operand and not the E_NOT node itself was freed, due to accidentally returning too early in expr_free(). Outline of leak: switch (e->type) { ... case E_NOT: expr_free(e->left.expr); return; ... } *Never reached, 'e' leaked* free(e); Fix by changing the 'return' to a 'break'. Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix: LEAK SUMMARY: definitely lost: 44,448 bytes in 1,852 blocks ... Summary after the fix: LEAK SUMMARY: definitely lost: 1,608 bytes in 67 blocks ... Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> --- scripts/kconfig/expr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)