[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240903091208.7152-1-zhangjiao2@cmss.chinamobile.com>
Date: Tue, 3 Sep 2024 17:12:08 +0800
From: zhangjiao2 <zhangjiao2@...s.chinamobile.com>
To: peterz@...radead.org
Cc: mingo@...hat.com,
acme@...nel.org,
namhyung@...nel.org,
linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org,
zhang jiao <zhangjiao2@...s.chinamobile.com>
Subject: [PATCH] perf namespaces: check newns before free
From: zhang jiao <zhangjiao2@...s.chinamobile.com>
Since newns can be NULL, check it before free
Signed-off-by: zhang jiao <zhangjiao2@...s.chinamobile.com>
---
tools/perf/util/namespaces.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c
index cb185c5659d6..49e20e0a567a 100644
--- a/tools/perf/util/namespaces.c
+++ b/tools/perf/util/namespaces.c
@@ -135,7 +135,8 @@ int nsinfo__init(struct nsinfo *nsi)
&RC_CHK_ACCESS(nsi)->in_pidns, spath);
out:
- free(newns);
+ if (newns)
+ free(newns);
return rv;
}
--
2.33.0
Powered by blists - more mailing lists