lkml.org 
[lkml]   [2023]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] perf tools: Put the function return operation at the end of the function
Date
Function return operations should be performed after resource release.

Fixes: 4e1b9c679fcb ("perf tools: Refactor print_event_desc()")
Signed-off-by: Kunwu.Chan <chentao@kylinos.cn>
---
tools/perf/util/header.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index d812e1e371a7..5763f21844b1 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1998,13 +1998,14 @@ static struct evsel *read_event_desc(struct feat_fd *ff)
id++;
}
}
-out:
- free(buf);
- return events;
+
error:
free_event_desc(events);
events = NULL;
- goto out;
+
+out:
+ free(buf);
+ return events;
}

static int __desc_attr__fprintf(FILE *fp, const char *name, const char *val,
--
2.25.1
\
 
 \ /
  Last update: 2023-10-12 05:11    [W:0.050 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site