Skip to contentSkip to conversation

perf: symbol - mark vmlinux filename as allocated

PATCH New David Ahern 1 participant 1 message Jan 14, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: symbol - mark vmlinux filename as allocated

Needs to be marked allocated so memory can be freed when dso is deleted.

---
 tools/perf/util/symbol.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/util/symbol.c +5 -1
index 295f8d4..61edfd0 100644
@@ -1124,8 +1124,10 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map,
 	filename = dso__build_id_filename(dso, NULL, 0);
 	if (filename != NULL) {
 		err = dso__load_vmlinux(dso, map, filename, filter);
-		if (err > 0)
+		if (err > 0) {
+			dso->lname_alloc = 1;
 			goto out;
+		}
 		free(filename);
 	}
 
@@ -1133,6 +1135,7 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map,
 		err = dso__load_vmlinux(dso, map, vmlinux_path[i], filter);
 		if (err > 0) {
 			dso__set_long_name(dso, strdup(vmlinux_path[i]));
+			dso->lname_alloc = 1;
 			break;
 		}
 	}
@@ -1172,6 +1175,7 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map,
 		if (err > 0) {
 			dso__set_long_name(dso,
 					   strdup(symbol_conf.vmlinux_name));
+			dso->lname_alloc = 1;
 			goto out_fixup;
 		}
 		return err;
Signature · 1 line
1.7.10.1