]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf srcline: Introduce inline_node__clear_frames()
authorIan Rogers <irogers@google.com>
Mon, 4 May 2026 08:12:21 +0000 (01:12 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 6 May 2026 00:49:18 +0000 (21:49 -0300)
Introduce inline_node__clear_frames() to clean up partial allocations.
This is a prerequisite for error handling in libdw inline unwinding.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zecheng Li <zli94@ncsu.edu>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/srcline.c
tools/perf/util/srcline.h

index db164d25816347acb8f51076da12fd25ad409f83..62884428fb5a044108f394c0935e9e8efcfd41cb 100644 (file)
@@ -429,10 +429,13 @@ struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr,
        return addr2inlines(dso_name, addr, dso, sym);
 }
 
-void inline_node__delete(struct inline_node *node)
+void inline_node__clear_frames(struct inline_node *node)
 {
        struct inline_list *ilist, *tmp;
 
+       if (node == NULL)
+               return;
+
        list_for_each_entry_safe(ilist, tmp, &node->val, list) {
                list_del_init(&ilist->list);
                zfree_srcline(&ilist->srcline);
@@ -441,7 +444,11 @@ void inline_node__delete(struct inline_node *node)
                        symbol__delete(ilist->symbol);
                free(ilist);
        }
+}
 
+void inline_node__delete(struct inline_node *node)
+{
+       inline_node__clear_frames(node);
        free(node);
 }
 
index 7c37b3bf9ce79379682d6d087f862c791cbad9af..1018cbc886d6256f2cb07ee06d463eeb28ac3d33 100644 (file)
@@ -47,6 +47,7 @@ struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr,
                                            struct symbol *sym);
 /* free resources associated to the inline node list */
 void inline_node__delete(struct inline_node *node);
+void inline_node__clear_frames(struct inline_node *node);
 
 /* insert the inline node list into the DSO, which will take ownership */
 void inlines__tree_insert(struct rb_root_cached *tree,