Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3864722ybg; Sun, 20 Oct 2019 23:27:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIUq0ZUPeFWX4KV5CMn00ZQeKvO5jDTVO+JJo2J9QoRq8tZY6Tm7FXCCeBo6Pt3gF5W874 X-Received: by 2002:a17:906:27ce:: with SMTP id k14mr2704712ejc.72.1571639265065; Sun, 20 Oct 2019 23:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571639265; cv=none; d=google.com; s=arc-20160816; b=CAssbM0nostDJqtcobjHoBdDxO8ZMQX5geKazVgac93FKnLjFHTYso3LYybP3ER752 8Dctr+khdghWeBcam0uTx235zTr88NmHROsopdsD/ZMui/FaUxmNc2jdvEB+lHWvIxVW qJKpC0rU4I4P1k4VS/P0+/XksyVIYQtSYC4Sr6U1tWjFSAuhi5+FsueaiXt5wQswnRyf TmaTBNfFIUddMDPdvE7TbhQPP4hsrNKFezHm4UbXSeIlk2K931s+SBi4blnUpAuiIpkK 61sLXve7ckX3Q+XqN+6YL9HAFonu0WyR2xIvEL3XMDaznE4XSOqZlgw0ewhnEOHIwMrs jDcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=F8hbl5t5EeXZptlaktA67rnJ4jJ5fOPmhGbN1yzPRNQ=; b=LXhTfBjdh4nS/PFW+fhhAUUDVnLqYFT/UAJS5E/YnAuA9fZyqdnjXrpuesxPUhVMbM +HTWUxa0MI2vBJeSW1QA+5kwVyDdFAr4CjxRwyZEIS1jpT1RX9fUCRbmdfSJc2cNkasm j3Bl5wwHUGkPn6aqPyK4RcmcWv7N7viqd0JJMry2TYw4Vbd28yAdwaB64bPSCKS5ASUC bh3v+ZDRXwH4+loGysvVIc16dzgOoXDdR9zMtjb32LSZqjoUpu54pUQq3U0jcDc9PyCP 4bSdgTWXTFWEJc140YTWYVthWzTzVLeWHIM3OksNK8kIIwBuRO8BqIM3mwj7QKr2sJH/ irgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nh5si8226650ejb.154.2019.10.20.23.27.22; Sun, 20 Oct 2019 23:27:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727261AbfJUG1E (ORCPT + 99 others); Mon, 21 Oct 2019 02:27:04 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:33241 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727221AbfJUG1B (ORCPT ); Mon, 21 Oct 2019 02:27:01 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iMR9N-00025h-Dq; Mon, 21 Oct 2019 08:26:41 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id B4E4A1C0092; Mon, 21 Oct 2019 08:26:40 +0200 (CEST) Date: Mon, 21 Oct 2019 06:26:40 -0000 From: "tip-bot2 for Yunfeng Ye" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf kmem: Fix memory leak in compact_gfp_flags() Cc: Yunfeng Ye , Alexander Shishkin , Feilong Lin , Hu Shiyuan , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <157163920042.29376.8707217157617619218.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 1abecfcaa7bba21c9985e0136fa49836164dd8fd Gitweb: https://git.kernel.org/tip/1abecfcaa7bba21c9985e0136fa49836164dd8fd Author: Yunfeng Ye AuthorDate: Wed, 16 Oct 2019 16:38:45 +08:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Wed, 16 Oct 2019 10:08:32 -03:00 perf kmem: Fix memory leak in compact_gfp_flags() The memory @orig_flags is allocated by strdup(), it is freed on the normal path, but leak to free on the error path. Fix this by adding free(orig_flags) on the error path. Fixes: 0e11115644b3 ("perf kmem: Print gfp flags in human readable string") Signed-off-by: Yunfeng Ye Cc: Alexander Shishkin Cc: Feilong Lin Cc: Hu Shiyuan Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/f9e9f458-96f3-4a97-a1d5-9feec2420e07@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-kmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 1e61e35..9661671 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -691,6 +691,7 @@ static char *compact_gfp_flags(char *gfp_flags) new = realloc(new_flags, len + strlen(cpt) + 2); if (new == NULL) { free(new_flags); + free(orig_flags); return NULL; }