From patchwork Tue Oct 22 01:25:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liujing X-Patchwork-Id: 13845676 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20C73D2C54E for ; Tue, 22 Oct 2024 13:13:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 32E016B0092; Tue, 22 Oct 2024 09:13:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2DE9F6B0093; Tue, 22 Oct 2024 09:13:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CD326B0095; Tue, 22 Oct 2024 09:13:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 009326B0092 for ; Tue, 22 Oct 2024 09:13:45 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5D63A141326 for ; Tue, 22 Oct 2024 13:13:28 +0000 (UTC) X-FDA: 82701279780.27.3DD6713 Received: from cmccmta1.chinamobile.com (cmccmta6.chinamobile.com [111.22.67.139]) by imf03.hostedemail.com (Postfix) with ESMTP id 9586820004 for ; Tue, 22 Oct 2024 13:13:34 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf03.hostedemail.com: domain of liujing@cmss.chinamobile.com designates 111.22.67.139 as permitted sender) smtp.mailfrom=liujing@cmss.chinamobile.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729602700; a=rsa-sha256; cv=none; b=Yf5i8AO9jXpBOKh4XRud4V7dB00KVYAW4gNXPc6VxJysgDE3tTXPnoUq72iHby7CEuKalb y4hPeQ+UEcIAw87IR8syTTMcf39cWFadhZB+xSr6Gh1+X4Oir6ichBjqyo6kqv+DD7thEW Ic6A4r2NUjjIb88PK+8KRVRjG47jq5U= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf03.hostedemail.com: domain of liujing@cmss.chinamobile.com designates 111.22.67.139 as permitted sender) smtp.mailfrom=liujing@cmss.chinamobile.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729602700; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=VoSgbaIW8nDPgLdSvXRWwF3yTuFFSQqy3N7aW/mKRWw=; b=J/2pgDZLM6e2xpIjrKorpsTGd2rn5GFkrT1Y2gguFNG4dhC8jy0Rppg5eAeph/VcB5ExmD C9HebXjKmXpwug0ZL7G8ZTznXQMafhAIKVtjBd349LzGMZNBFSWf1xisaIXLDQ5f4I05AC gFKad+0N9U2gkBGhTjaxUr6wOr7L/ok= X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from spf.mail.chinamobile.com (unknown[10.188.0.87]) by rmmx-syy-dmz-app01-12001 (RichMail) with SMTP id 2ee16717a50066a-30f79; Tue, 22 Oct 2024 21:13:39 +0800 (CST) X-RM-TRANSID: 2ee16717a50066a-30f79 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.108.79.103]) by rmsmtp-syy-appsvr04-12004 (RichMail) with SMTP id 2ee46717a502c0c-885fc; Tue, 22 Oct 2024 21:13:39 +0800 (CST) X-RM-TRANSID: 2ee46717a502c0c-885fc From: Liu Jing To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Liu Jing Subject: [PATCH] tools/mm: Free the allocated memory Date: Tue, 22 Oct 2024 09:25:26 +0800 Message-Id: <20241022012526.7597-1-liujing@cmss.chinamobile.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 9586820004 X-Stat-Signature: 813hc4bkgnjzhgdsaqiiyea8ent6qko8 X-Rspam-User: X-HE-Tag: 1729602814-187993 X-HE-Meta: U2FsdGVkX19HDnPXblEwGRXsrvsXRC3uMlh1HIGmsfva17eMfWdVwMis0TIItRGG5L0NiXUcZuKwPRVuCPkmWzxje1+rsyB9eoxBg+nmB5Mqxj/sRaahKDZk2cNzyfPpM6gzCYV4I+L7t0uHsC/83hsRR4OjGlyDYjYGo4sSEk9rvLztkk6ZsLjZxd0WQtXXS+Bt2Y5qt3C6Ux1PE78drWk16vadnSzTuxRGEmt2Y2WrSFJ1K90bL1s9GMls4eHFoYFXyV8pdR9l4jC1IlJgFlqbh+9Na+Q7hRtiDz7IUHzb2fKOdJ/7I5aOi9B/Ic5ePlTGojBnoo+tbebpPUAoeu/3P41sPjksqURYPzsFyor4Yyz9UE4/uUpKr+BxDcANPCyAkT8a/5hahUU39a8jsJQyEPMo0OlCMDMtHbu0Sqh79mlwxEgEI38DTLRlN2lEf6yaSZxvF44mQfA1s3dQEwC59/QpODZq3fBpa5euy0BVgvwNFUULL4MYOB1v1wwgpkmNm9XwAdeGkGQm2YbZX6KMja+wlAQbLwpF+3QR5j6KAkcLKa7VQWkOlNQ0/VTKIG3uAdc+oe9CPvVas4dhDvecpl61RN+dWBnYH5/65SAwObBYfuKvMlCTrHUcB4WuLCPwdyubFyenzlwecrl6TuDmIhLAnqqdJbqmlqEbYKvzbciuOwb31kBI/Ys0j2uQ1oPqT4T+vhMSJHbV8RiFx2cH5lFndmkV/r0K2xR7/wgVAT4P3P9OVbfDjzBwHTFQs4cN2jBdrMBMHVvEINu+lGh6PXPxMfylrIMXSeQbO+rHk+CF1hAoBfl0zrk/nQsUO9D/pLb4eJfJ9s1FTv2zKcFplZj3bgbesKoQSIsLjRGQU9OsVw2jCRsta8s4jMs4vd/rX8AnV/peg1mJJvf9YXgfymKTrsAKUGH9C/vG6qKJHPTZIlVcCuVf0SI2MCiSVCIxhFsY1VIaFkKbY// 5ZWTAMoM kZnStdg2bBFX446LC+/11HufscHvb4uNpZMJnFdIDFkH9KGPr5Jws7Uu4yQmuecANL3G1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The comm_str memory needs to be freed if the search_pattern function call fails in get_comm Signed-off-by: Liu Jing diff --git a/tools/mm/page_owner_sort.c b/tools/mm/page_owner_sort.c index e1f264444342..724d024e0756 100644 --- a/tools/mm/page_owner_sort.c +++ b/tools/mm/page_owner_sort.c @@ -377,6 +377,7 @@ static char *get_comm(char *buf) if (errno != 0) { if (debug_on) fprintf(stderr, "wrong comm in follow buf:\n%s\n", buf); + free (comm_str); return NULL; }