[BUGFIX][PATCH v8 1/5] perf config: Handle the error about NULL at perf_config_set__delete()
From: Taeung Song
Date: Wed Jun 08 2016 - 08:37:12 EST
perf_config_set__delete() purge and free the config set
that contains all config key-value pairs.
But if the config set (i.e. 'set' variable at the function)
is NULL, this is wrong so handle it.
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Wang Nan <wangnan0@xxxxxxxxxx>
Signed-off-by: Taeung Song <treeze.taeung@xxxxxxxxx>
---
tools/perf/util/config.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 8749eca..31e09a4 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -742,6 +742,9 @@ static void perf_config_set__purge(struct perf_config_set *set)
void perf_config_set__delete(struct perf_config_set *set)
{
+ if (set == NULL)
+ return;
+
perf_config_set__purge(set);
free(set);
}
--
2.5.0