From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f201.google.com (mail-dy1-f201.google.com [74.125.82.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99433305677 for ; Wed, 24 Jun 2026 05:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782278155; cv=none; b=EbXnB86A73RF2wSQrK44ORM88JMtpznS3WRx0cB7HLzAoJOT8MEc3F6GfHV2TlK76XwigGOFEEpoEwBZcGuCq5YyxVhJOmJLmgBTA28kjf2euIL9oON7qYYg8IzesRLD4tmVmqGQCUNSm5xsMK+fMFM7yJ36w81+hJYZJznZ1CE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782278155; c=relaxed/simple; bh=bg38aem3dRgxxrk43rqzKKIwQoEWTyq5SDngervhvDA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=iaASoZWlXRaion0UdL5e5qUez/8/brcmDPaJxYeXESgCgEyAvU0HSvl4MNMcBMUwnXItxzpfQdPhmVGJ3VS94H43HjE3iACruGOocgxgeOmPJhzsz76bHMMu63YB2qEXkdS0Y2RyXQEoKOeCBnM+V8pBDx2xQizjlOcORr+QH9I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=SOeUTcy7; arc=none smtp.client-ip=74.125.82.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="SOeUTcy7" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-30c62861b3bso1789240eec.0 for ; Tue, 23 Jun 2026 22:15:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782278152; x=1782882952; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=eZ83MloBDVhnVzmNpDfky8cBZjRi2ReFfX/sUYDH8fw=; b=SOeUTcy7iEFXF685T6UwDqLqmUyFAYhQolYT5XKZXg8QMmtMjs/VG8ineJ2/sNXQKr GARag9Z+Uk1nn62d9FtKwttgfG9tzlwoFUJ7kzv6YhgvsvrwsmP51iM1yzTdWayvQ3G4 W9nH7UQsSX8ceoMwx1qmPc7PfbeQHbVzVmt/awg/BTCloqLL84d7AkQWfDHze4GRLr4y wLbUCcQDgZ3Qor+pwJmnCmgLA2i/RtENN4i6EOKh0+LHX9PojdXsk6HDtXP/WVAbTKyr 9yKDEVXRaXp/UZ4YVHE608Sv9MQOY7Sxk6LJHPa1ZksCmcIPx8tbbGlBaHnRzttC3oy5 BObg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782278152; x=1782882952; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eZ83MloBDVhnVzmNpDfky8cBZjRi2ReFfX/sUYDH8fw=; b=Vz47U9X4/gTSbwu7UQnZnNU9ebWm4/Wj3eZw7zpIdGAnBLGNJdS1yasDfoS+Oy5SB8 mJOLgH6vzTxBPLM/MmAl2bOH2uuCK/KwHu3LdObA4LYIxfxetQxfJc2ZWF3wLC5j9vRZ vWwkkDkmH2HpJTehDDChlFImtI1FrFPzkh86AkkJEDRsyvnKcYwhg8wYgDb3DANZWVi0 kKsOzteYJclGU4cXQWAOxZaXtwJtSdLygUq/lHu3MANVze0decIeRUAYFCVd31e88xVO LsS5HB/Ubk2+pqrUgPmjNCnG6iWgfSdxYYxZKLKxqzeCUtwk2qZc56fmwHcW+N/FjkU9 ywFg== X-Forwarded-Encrypted: i=1; AHgh+Rrs/4r2o+z1H/K9Bh/bhAHLFSToNy06cKL8UpZTP75rrTgbpelMurdn0aCTx1KnZveoX+6H7wZaWokiqac=@vger.kernel.org X-Gm-Message-State: AOJu0YzXGznNSaxb0OLXRsS8apyGqvsiAz8otf+LVBl8YqtqnivPAZEl SWWM8U7ysNLka8Zt8k27cINOd/UuYZqY0/OyLYfSNmLrHTEo/JUPAbqLyeaKje2TgY95kvxM3mt 6ngl5wEK36g== X-Received: from dybvz1.prod.google.com ([2002:a05:7301:7a01:b0:30c:5a76:5abe]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:4e0c:b0:2ed:e16:6b4a with SMTP id 5a478bee46e88-30c1dc8957cmr13537283eec.32.1782278151264; Tue, 23 Jun 2026 22:15:51 -0700 (PDT) Date: Tue, 23 Jun 2026 22:15:22 -0700 In-Reply-To: <20260624051535.3584977-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260623053515.2677888-1-irogers@google.com> <20260624051535.3584977-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260624051535.3584977-6-irogers@google.com> Subject: [PATCH v2 04/16] perf python: Fix memory leak in pyrf_evlist__get_pollfd From: Ian Rogers To: irogers@google.com, acme@kernel.org, namhyung@kernel.org Cc: adrian.hunter@intel.com, alice.mei.rogers@gmail.com, dapeng1.mi@linux.intel.com, james.clark@linaro.org, leo.yan@linux.dev, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, tmricht@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Fix a Python list object leak in pyrf_evlist__get_pollfd() by adding a missing Py_DECREF on the error exit path. Assisted-by: Antigravity:gemini-3.1-pro Fixes: 877108e42b1b ("perf tools: Initial python binding") Signed-off-by: Ian Rogers --- tools/perf/util/python.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 11e1f39c1bea..550f1e7d1449 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -2825,6 +2825,8 @@ static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist, evlist = pevlist->evlist; list = PyList_New(0); + if (!list) + return NULL; for (i = 0; i < evlist__core(evlist)->pollfd.nr; ++i) { PyObject *file; @@ -2843,6 +2845,7 @@ static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist, return list; free_list: + Py_XDECREF(list); return PyErr_NoMemory(); } -- 2.55.0.rc0.799.gd6f94ed593-goog