From patchwork Tue Feb 6 08:32:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 197249 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1401082dyb; Tue, 6 Feb 2024 00:39:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IH4Eu3bMKrxFCN/QNwpAcUcPAqV047BaxBG4RO/SuwKskOMGp0i1U/CUXbQJEndrw+NNF9B X-Received: by 2002:a2e:7c07:0:b0:2cf:425b:59ee with SMTP id x7-20020a2e7c07000000b002cf425b59eemr1306139ljc.24.1707208761292; Tue, 06 Feb 2024 00:39:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707208761; cv=pass; d=google.com; s=arc-20160816; b=McWiicwXt6VJ4ol7zJfXV0/X/+mK7lV8jDXgcuS3hKNRM3aykpBlEx+/d6by4auKo3 MEjXEONjXiEzdxOWXuRy5StUFFc0kVSSD0a8o6oWHAfjT33mL6QLTxX8yssvINO2vzJp oMCFUMEp/6ViqoyE1n7qB147kFVFCGTMQy6HUI2zTkd6+QHozPN1TtZNcQ9nZbCMFXcG B5Ib1uEot2DGEb7MdQ7xLV7K/VT9qb1Pc2xab1xULnvMqFVMhgUnpZOAou3asgU8Fznl aRPcm+iwYmYu9nG1eoiVXUb6XIUIDI8B9UD8vqbrPqkR3YziqSoxqYRLg+2UVmIyJ14e tdBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=SyPhNS/N/Z8iH+Hbr0qv7AmqfEsTMPkvb4mWs/7kn6Q=; fh=e2+TC3/3CW6q+BrlheQxA2Prq9JQK9GgcqHJcDHYSek=; b=xfUOHxz3ZqFmUia0WE8ChGUotX4/d8GrOf++Ep9+aPMDqNwdDRJ+gifYH3wWGaAdqS IPjZdGfw+EdxmazDi2G1wMGDrQze6qKgYOjFG+2UhSKw+OB8ONdwg8eOEJTXqN0DULZq pWE4bOehTY03RuyaP4U+oLNleYzsc/8PjQXXcesSJqVOGTtA/A8fN7ffYDL1phPtXrKd Fdi9fIL+8KB+ANrr5LLB9VEx3unJ9GyXY/7xFm0nw2OLXOda0xDQlvelwJxF19JikP2V 2BKEXZ5lUgqpC/c5UHKOKUU6sqwVjWG8XbUr+rzo2Oym+6ihNLPfMbIqwWv3JEo2zAhz TODA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-54503-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54503-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCVzz5rtsExBl0vySHcauDUBGB4qKDDgog6zhCCiv9bE1VM5mEq4305/sM4xJTQTofKoj/Jm4R54bYmmuWCyO/FkKwiHMQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y23-20020aa7ccd7000000b0055ed0e8eef0si886148edt.516.2024.02.06.00.39.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 00:39:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54503-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-54503-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54503-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CD7A61F22E3F for ; Tue, 6 Feb 2024 08:39:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09FF712D15E; Tue, 6 Feb 2024 08:37:34 +0000 (UTC) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6051A12BEB7; Tue, 6 Feb 2024 08:37:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707208652; cv=none; b=UvlrWof64JJvIqcb0eB7p0y91fSfAkgBMiYGMxsz7xymCuwBDUMJ5rJIyw6arGpucBWxNbG1IX1q4iLlIcA6kioy/3PrSIPLFkujwhKkXQM+3oAo7O3ya+aNPaVnpnDs9t3BbVwWUW16K3U/fcM+T/kR/yN8Wc2cW+2WPQ+SW7k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707208652; c=relaxed/simple; bh=/xpATSrVpRUAb/2rTYqzEK+C8mbseixibxzL286QETI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YcyvtcHoM+yKFvqNNJ61zlA46iGlJGh4ju3bUXtTSH8a2XgnZNKFZg+3o0AKTl2CixMwR6kg+HR1/V9BReskV/558Qw2+PS9Jue/opcDUOm7/Hd8tkRTP8iaVZOqVkNc1tOs5vSY/Osc1HcSIol3Znt8yeQv1RXbbD5adbEqVpk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4TTc703Mnqz1vtCj; Tue, 6 Feb 2024 16:37:00 +0800 (CST) Received: from kwepemm600003.china.huawei.com (unknown [7.193.23.202]) by mail.maildlp.com (Postfix) with ESMTPS id 200C6140390; Tue, 6 Feb 2024 16:37:28 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 6 Feb 2024 16:37:27 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH v2 5/5] perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str() Date: Tue, 6 Feb 2024 08:32:28 +0000 Message-ID: <20240206083228.172607-6-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206083228.172607-1-yangjihong1@huawei.com> References: <20240206083228.172607-1-yangjihong1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600003.china.huawei.com (7.193.23.202) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790138133779703413 X-GMAIL-MSGID: 1790138133779703413 slist needs to be freed in both error path and normal path in thread_map__new_by_tid_str(). Fixes: b52956c961be3a04 ("perf tools: Allow multiple threads or processes in record, stat, top") Reviewed-by: Arnaldo Carvalho de Melo Signed-off-by: Yang Jihong --- tools/perf/util/thread_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c index e848579e61a8..ea3b431b9783 100644 --- a/tools/perf/util/thread_map.c +++ b/tools/perf/util/thread_map.c @@ -280,13 +280,13 @@ struct perf_thread_map *thread_map__new_by_tid_str(const char *tid_str) threads->nr = ntasks; } out: + strlist__delete(slist); if (threads) refcount_set(&threads->refcnt, 1); return threads; out_free_threads: zfree(&threads); - strlist__delete(slist); goto out; }