Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Use zfree() where applicable

In places where the equivalent was already being done, i.e.:

free(a);
a = NULL;

And in placs where struct members are being freed so that if we have
some erroneous reference to its struct, then accesses to freed members
will result in segfaults, which we can detect faster than use after free
to areas that may still have something seemingly valid.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-jatyoofo5boc1bsvoig6bb6i@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+100 -99
+2 -1
tools/perf/bench/futex-hash.c
··· 18 18 #include <stdlib.h> 19 19 #include <linux/compiler.h> 20 20 #include <linux/kernel.h> 21 + #include <linux/zalloc.h> 21 22 #include <sys/time.h> 22 23 23 24 #include "../util/stat.h" ··· 215 214 &worker[i].futex[nfutexes-1], t); 216 215 } 217 216 218 - free(worker[i].futex); 217 + zfree(&worker[i].futex); 219 218 } 220 219 221 220 print_summary();
+2 -1
tools/perf/bench/futex-lock-pi.c
··· 12 12 #include <subcmd/parse-options.h> 13 13 #include <linux/compiler.h> 14 14 #include <linux/kernel.h> 15 + #include <linux/zalloc.h> 15 16 #include <errno.h> 16 17 #include "bench.h" 17 18 #include "futex.h" ··· 218 217 worker[i].tid, worker[i].futex, t); 219 218 220 219 if (multi) 221 - free(worker[i].futex); 220 + zfree(&worker[i].futex); 222 221 } 223 222 224 223 print_summary();
+2 -2
tools/perf/builtin-record.c
··· 11 11 #include "perf.h" 12 12 13 13 #include "util/build-id.h" 14 - #include "util/util.h" 15 14 #include <subcmd/parse-options.h> 16 15 #include "util/parse-events.h" 17 16 #include "util/config.h" ··· 53 54 #include <sys/mman.h> 54 55 #include <sys/wait.h> 55 56 #include <linux/time64.h> 57 + #include <linux/zalloc.h> 56 58 57 59 struct switch_output { 58 60 bool enabled; ··· 1110 1110 rec->switch_output.cur_file = n; 1111 1111 if (rec->switch_output.filenames[n]) { 1112 1112 remove(rec->switch_output.filenames[n]); 1113 - free(rec->switch_output.filenames[n]); 1113 + zfree(&rec->switch_output.filenames[n]); 1114 1114 } 1115 1115 rec->switch_output.filenames[n] = new_filename; 1116 1116 } else {
+2 -2
tools/perf/builtin-stat.c
··· 1586 1586 for (i = 0; i < config->stats_num; i++) 1587 1587 runtime_stat__exit(&config->stats[i]); 1588 1588 1589 - free(config->stats); 1589 + zfree(&config->stats); 1590 1590 } 1591 1591 1592 1592 static const char * const stat_report_usage[] = { ··· 2003 2003 perf_stat__exit_aggr_mode(); 2004 2004 perf_evlist__free_stats(evsel_list); 2005 2005 out: 2006 - free(stat_config.walltime_run); 2006 + zfree(&stat_config.walltime_run); 2007 2007 2008 2008 if (smi_cost && smi_reset) 2009 2009 sysfs__write_int(FREEZE_ON_SMI_PATH, 0);
+3 -2
tools/perf/tests/dwarf-unwind.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/compiler.h> 3 3 #include <linux/types.h> 4 + #include <linux/zalloc.h> 4 5 #include <inttypes.h> 5 6 #include <unistd.h> 6 7 #include "tests.h" ··· 116 115 } 117 116 118 117 out: 119 - free(sample.user_stack.data); 120 - free(sample.user_regs.regs); 118 + zfree(&sample.user_stack.data); 119 + zfree(&sample.user_regs.regs); 121 120 return err; 122 121 } 123 122
+2 -1
tools/perf/tests/expr.c
··· 3 3 #include "util/expr.h" 4 4 #include "tests.h" 5 5 #include <stdlib.h> 6 + #include <linux/zalloc.h> 6 7 7 8 static int test(struct parse_ctx *ctx, const char *e, double val2) 8 9 { ··· 59 58 TEST_ASSERT_VAL("find other", other[3] == NULL); 60 59 61 60 for (i = 0; i < num_other; i++) 62 - free((void *)other[i]); 61 + zfree(&other[i]); 63 62 free((void *)other); 64 63 65 64 return 0;
+2 -1
tools/perf/tests/mem2node.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/compiler.h> 3 3 #include <linux/bitmap.h> 4 + #include <linux/zalloc.h> 4 5 #include "cpumap.h" 5 6 #include "mem2node.h" 6 7 #include "tests.h" ··· 68 67 T("failed: mem2node__node", -1 == mem2node__node(&map, 0x1050)); 69 68 70 69 for (i = 0; i < ARRAY_SIZE(nodes); i++) 71 - free(nodes[i].set); 70 + zfree(&nodes[i].set); 72 71 73 72 mem2node__exit(&map); 74 73 return 0;
+2 -1
tools/perf/tests/thread-map.c
··· 6 6 #include "tests.h" 7 7 #include "thread_map.h" 8 8 #include "debug.h" 9 + #include <linux/zalloc.h> 9 10 10 11 #define NAME (const char *) "perf" 11 12 #define NAMEUL (unsigned long) NAME ··· 134 133 thread_map__remove(threads, 0)); 135 134 136 135 for (i = 0; i < threads->nr; i++) 137 - free(threads->map[i].comm); 136 + zfree(&threads->map[i].comm); 138 137 139 138 free(threads); 140 139 return 0;
+3 -3
tools/perf/ui/browsers/res_sample.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* Display a menu with individual samples to browse with perf script */ 3 - #include "util.h" 4 3 #include "hist.h" 5 4 #include "evsel.h" 6 5 #include "hists.h" ··· 7 8 #include "config.h" 8 9 #include "time-utils.h" 9 10 #include <linux/time64.h> 11 + #include <linux/zalloc.h> 10 12 11 13 static u64 context_len = 10 * NSEC_PER_MSEC; 12 14 ··· 46 46 if (asprintf(&names[i], "%s: CPU %d tid %d", tbuf, 47 47 res_samples[i].cpu, res_samples[i].tid) < 0) { 48 48 while (--i >= 0) 49 - free(names[i]); 49 + zfree(&names[i]); 50 50 free(names); 51 51 return -1; 52 52 } 53 53 } 54 54 choice = ui__popup_menu(num_res, names); 55 55 for (i = 0; i < num_res; i++) 56 - free(names[i]); 56 + zfree(&names[i]); 57 57 free(names); 58 58 59 59 if (choice < 0 || choice >= num_res)
+2 -2
tools/perf/ui/browsers/scripts.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include "../../util/sort.h" 3 - #include "../../util/util.h" 4 3 #include "../../util/hist.h" 5 4 #include "../../util/debug.h" 6 5 #include "../../util/symbol.h" 7 6 #include "../browser.h" 8 7 #include "../libslang.h" 9 8 #include "config.h" 9 + #include <linux/zalloc.h> 10 10 11 11 #define SCRIPT_NAMELEN 128 12 12 #define SCRIPT_MAX_NO 64 ··· 142 142 out: 143 143 free(buf); 144 144 for (i = 0; i < max_std; i++) 145 - free(paths[i]); 145 + zfree(&paths[i]); 146 146 return ret; 147 147 } 148 148
+1 -2
tools/perf/util/annotate.c
··· 1235 1235 dl->ins.ops->free(&dl->ops); 1236 1236 else 1237 1237 ins__delete(&dl->ops); 1238 - free((void *)dl->ins.name); 1239 - dl->ins.name = NULL; 1238 + zfree(&dl->ins.name); 1240 1239 annotation_line__delete(&dl->al); 1241 1240 } 1242 1241
+2 -3
tools/perf/util/auxtrace.c
··· 1413 1413 return; 1414 1414 1415 1415 auxtrace_cache__drop(c); 1416 - free(c->hashtable); 1416 + zfree(&c->hashtable); 1417 1417 free(c); 1418 1418 } 1419 1419 ··· 1459 1459 1460 1460 static void addr_filter__free_str(struct addr_filter *filt) 1461 1461 { 1462 - free(filt->str); 1462 + zfree(&filt->str); 1463 1463 filt->action = NULL; 1464 1464 filt->sym_from = NULL; 1465 1465 filt->sym_to = NULL; 1466 1466 filt->filename = NULL; 1467 - filt->str = NULL; 1468 1467 } 1469 1468 1470 1469 static struct addr_filter *addr_filter__new(void)
+1 -1
tools/perf/util/cgroup.c
··· 124 124 return cgroup; 125 125 126 126 out_free_name: 127 - free(cgroup->name); 127 + zfree(&cgroup->name); 128 128 out_err: 129 129 free(cgroup); 130 130 return NULL;
+1 -1
tools/perf/util/cputopo.c
··· 344 344 u32 i; 345 345 346 346 for (i = 0; i < tp->nr; i++) 347 - free(tp->nodes[i].cpus); 347 + zfree(&tp->nodes[i].cpus); 348 348 349 349 free(tp); 350 350 }
+2 -3
tools/perf/util/cs-etm.c
··· 555 555 etmq->traceid_queues_list = NULL; 556 556 557 557 /* finally free the traceid_queues array */ 558 - free(etmq->traceid_queues); 559 - etmq->traceid_queues = NULL; 558 + zfree(&etmq->traceid_queues); 560 559 } 561 560 562 561 static void cs_etm__free_queue(void *priv) ··· 2568 2569 err_free_metadata: 2569 2570 /* No need to check @metadata[j], free(NULL) is supported */ 2570 2571 for (j = 0; j < num_cpu; j++) 2571 - free(metadata[j]); 2572 + zfree(&metadata[j]); 2572 2573 zfree(&metadata); 2573 2574 err_free_traceid_list: 2574 2575 intlist__delete(traceid_list);
+1 -1
tools/perf/util/data-convert-bt.c
··· 1353 1353 for (cpu = 0; cpu < cw->stream_cnt; cpu++) 1354 1354 ctf_stream__delete(cw->stream[cpu]); 1355 1355 1356 - free(cw->stream); 1356 + zfree(&cw->stream); 1357 1357 } 1358 1358 1359 1359 static int ctf_writer__setup_env(struct ctf_writer *cw,
+1 -1
tools/perf/util/data.c
··· 21 21 { 22 22 while (--nr >= 1) { 23 23 close(files[nr].fd); 24 - free(files[nr].path); 24 + zfree(&files[nr].path); 25 25 } 26 26 free(files); 27 27 }
+4 -4
tools/perf/util/env.c
··· 187 187 zfree(&env->caches); 188 188 189 189 for (i = 0; i < env->nr_memory_nodes; i++) 190 - free(env->memory_nodes[i].set); 190 + zfree(&env->memory_nodes[i].set); 191 191 zfree(&env->memory_nodes); 192 192 } 193 193 ··· 287 287 288 288 void cpu_cache_level__free(struct cpu_cache_level *cache) 289 289 { 290 - free(cache->type); 291 - free(cache->map); 292 - free(cache->size); 290 + zfree(&cache->type); 291 + zfree(&cache->map); 292 + zfree(&cache->size); 293 293 } 294 294 295 295 /*
+1 -1
tools/perf/util/event.c
··· 856 856 free(synthesize_threads); 857 857 free_dirent: 858 858 for (i = 0; i < n; i++) 859 - free(dirent[i]); 859 + zfree(&dirent[i]); 860 860 free(dirent); 861 861 862 862 return err;
+3 -3
tools/perf/util/header.c
··· 1052 1052 1053 1053 scnprintf(file, PATH_MAX, "%s/size", path); 1054 1054 if (sysfs__read_str(file, &cache->size, &len)) { 1055 - free(cache->type); 1055 + zfree(&cache->type); 1056 1056 return -1; 1057 1057 } 1058 1058 ··· 1061 1061 1062 1062 scnprintf(file, PATH_MAX, "%s/shared_cpu_list", path); 1063 1063 if (sysfs__read_str(file, &cache->map, &len)) { 1064 - free(cache->map); 1065 - free(cache->type); 1064 + zfree(&cache->map); 1065 + zfree(&cache->type); 1066 1066 return -1; 1067 1067 } 1068 1068
+7 -7
tools/perf/util/hist.c
··· 472 472 return 0; 473 473 474 474 err_srcline: 475 - free(he->srcline); 475 + zfree(&he->srcline); 476 476 477 477 err_rawdata: 478 - free(he->raw_data); 478 + zfree(&he->raw_data); 479 479 480 480 err_infos: 481 481 if (he->branch_info) { 482 482 map__put(he->branch_info->from.map); 483 483 map__put(he->branch_info->to.map); 484 - free(he->branch_info); 484 + zfree(&he->branch_info); 485 485 } 486 486 if (he->mem_info) { 487 487 map__put(he->mem_info->iaddr.map); ··· 489 489 } 490 490 err: 491 491 map__zput(he->ms.map); 492 - free(he->stat_acc); 492 + zfree(&he->stat_acc); 493 493 return -ENOMEM; 494 494 } 495 495 ··· 1254 1254 zfree(&he->stat_acc); 1255 1255 free_srcline(he->srcline); 1256 1256 if (he->srcfile && he->srcfile[0]) 1257 - free(he->srcfile); 1257 + zfree(&he->srcfile); 1258 1258 free_callchain(he->callchain); 1259 - free(he->trace_output); 1260 - free(he->raw_data); 1259 + zfree(&he->trace_output); 1260 + zfree(&he->raw_data); 1261 1261 ops->free(he); 1262 1262 } 1263 1263
+3 -4
tools/perf/util/jitdump.c
··· 29 29 #include "../builtin.h" 30 30 31 31 #include <linux/ctype.h> 32 + #include <linux/zalloc.h> 32 33 33 34 struct jit_buf_desc { 34 35 struct perf_data *output; ··· 432 431 jd->unwinding_data, jd->eh_frame_hdr_size, jd->unwinding_size); 433 432 434 433 if (jd->debug_data && jd->nr_debug_entries) { 435 - free(jd->debug_data); 436 - jd->debug_data = NULL; 434 + zfree(&jd->debug_data); 437 435 jd->nr_debug_entries = 0; 438 436 } 439 437 440 438 if (jd->unwinding_data && jd->eh_frame_hdr_size) { 441 - free(jd->unwinding_data); 442 - jd->unwinding_data = NULL; 439 + zfree(&jd->unwinding_data); 443 440 jd->eh_frame_hdr_size = 0; 444 441 jd->unwinding_mapped_size = 0; 445 442 jd->unwinding_size = 0;
+1 -2
tools/perf/util/llvm-utils.c
··· 353 353 " \toption in [llvm] to \"\" to suppress this detection.\n\n", 354 354 *kbuild_dir); 355 355 356 - free(*kbuild_dir); 357 - *kbuild_dir = NULL; 356 + zfree(kbuild_dir); 358 357 goto errout; 359 358 } 360 359
+2 -2
tools/perf/util/machine.c
··· 810 810 out: 811 811 /* put the dso here, corresponding to machine__findnew_module_dso */ 812 812 dso__put(dso); 813 - free(m.name); 813 + zfree(&m.name); 814 814 return map; 815 815 } 816 816 ··· 1350 1350 if (m.kmod) 1351 1351 ret = map_groups__set_module_path(mg, path, &m); 1352 1352 1353 - free(m.name); 1353 + zfree(&m.name); 1354 1354 1355 1355 if (ret) 1356 1356 goto out;
+5 -4
tools/perf/util/metricgroup.c
··· 18 18 #include "strlist.h" 19 19 #include <assert.h> 20 20 #include <linux/ctype.h> 21 + #include <linux/zalloc.h> 21 22 22 23 struct metric_event *metricgroup__lookup(struct rblist *metric_events, 23 24 struct perf_evsel *evsel, ··· 236 235 goto out_name; 237 236 return &me->nd; 238 237 out_name: 239 - free((char *)me->name); 238 + zfree(&me->name); 240 239 out_me: 241 240 free(me); 242 241 return NULL; ··· 264 263 struct mep *me = container_of(nd, struct mep, nd); 265 264 266 265 strlist__delete(me->metrics); 267 - free((void *)me->name); 266 + zfree(&me->name); 268 267 free(me); 269 268 } 270 269 ··· 490 489 491 490 list_for_each_entry_safe (eg, egtmp, group_list, nd) { 492 491 for (i = 0; i < eg->idnum; i++) 493 - free((char *)eg->ids[i]); 494 - free(eg->ids); 492 + zfree(&eg->ids[i]); 493 + zfree(&eg->ids); 495 494 free(eg); 496 495 } 497 496 }
+24 -27
tools/perf/util/probe-event.c
··· 214 214 215 215 static void clear_perf_probe_point(struct perf_probe_point *pp) 216 216 { 217 - free(pp->file); 218 - free(pp->function); 219 - free(pp->lazy_line); 217 + zfree(&pp->file); 218 + zfree(&pp->function); 219 + zfree(&pp->lazy_line); 220 220 } 221 221 222 222 static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs) ··· 1175 1175 1176 1176 void line_range__clear(struct line_range *lr) 1177 1177 { 1178 - free(lr->function); 1179 - free(lr->file); 1180 - free(lr->path); 1181 - free(lr->comp_dir); 1178 + zfree(&lr->function); 1179 + zfree(&lr->file); 1180 + zfree(&lr->path); 1181 + zfree(&lr->comp_dir); 1182 1182 intlist__delete(lr->line_list); 1183 - memset(lr, 0, sizeof(*lr)); 1184 1183 } 1185 1184 1186 1185 int line_range__init(struct line_range *lr) ··· 2202 2203 struct perf_probe_arg_field *field, *next; 2203 2204 int i; 2204 2205 2205 - free(pev->event); 2206 - free(pev->group); 2207 - free(pev->target); 2206 + zfree(&pev->event); 2207 + zfree(&pev->group); 2208 + zfree(&pev->target); 2208 2209 clear_perf_probe_point(&pev->point); 2209 2210 2210 2211 for (i = 0; i < pev->nargs; i++) { 2211 - free(pev->args[i].name); 2212 - free(pev->args[i].var); 2213 - free(pev->args[i].type); 2212 + zfree(&pev->args[i].name); 2213 + zfree(&pev->args[i].var); 2214 + zfree(&pev->args[i].type); 2214 2215 field = pev->args[i].field; 2215 2216 while (field) { 2216 2217 next = field->next; ··· 2219 2220 field = next; 2220 2221 } 2221 2222 } 2222 - free(pev->args); 2223 - memset(pev, 0, sizeof(*pev)); 2223 + zfree(&pev->args); 2224 2224 } 2225 2225 2226 2226 #define strdup_or_goto(str, label) \ ··· 2300 2302 struct probe_trace_arg_ref *ref, *next; 2301 2303 int i; 2302 2304 2303 - free(tev->event); 2304 - free(tev->group); 2305 - free(tev->point.symbol); 2306 - free(tev->point.realname); 2307 - free(tev->point.module); 2305 + zfree(&tev->event); 2306 + zfree(&tev->group); 2307 + zfree(&tev->point.symbol); 2308 + zfree(&tev->point.realname); 2309 + zfree(&tev->point.module); 2308 2310 for (i = 0; i < tev->nargs; i++) { 2309 - free(tev->args[i].name); 2310 - free(tev->args[i].value); 2311 - free(tev->args[i].type); 2311 + zfree(&tev->args[i].name); 2312 + zfree(&tev->args[i].value); 2313 + zfree(&tev->args[i].type); 2312 2314 ref = tev->args[i].ref; 2313 2315 while (ref) { 2314 2316 next = ref->next; ··· 2316 2318 ref = next; 2317 2319 } 2318 2320 } 2319 - free(tev->args); 2320 - memset(tev, 0, sizeof(*tev)); 2321 + zfree(&tev->args); 2321 2322 } 2322 2323 2323 2324 struct kprobe_blacklist_node { ··· 2334 2337 node = list_first_entry(blacklist, 2335 2338 struct kprobe_blacklist_node, list); 2336 2339 list_del(&node->list); 2337 - free(node->symbol); 2340 + zfree(&node->symbol); 2338 2341 free(node); 2339 2342 } 2340 2343 }
+3 -4
tools/perf/util/s390-cpumsf.c
··· 1044 1044 auxtrace_heap__free(&sf->heap); 1045 1045 s390_cpumsf_free_queues(session); 1046 1046 session->auxtrace = NULL; 1047 - free(sf->logdir); 1047 + zfree(&sf->logdir); 1048 1048 free(sf); 1049 1049 } 1050 1050 ··· 1101 1101 if (rc == -1 || !S_ISDIR(stbuf.st_mode)) { 1102 1102 pr_err("Missing auxtrace log directory %s," 1103 1103 " continue with current directory...\n", value); 1104 - free(sf->logdir); 1105 - sf->logdir = NULL; 1104 + zfree(&sf->logdir); 1106 1105 } 1107 1106 return 1; 1108 1107 } ··· 1161 1162 auxtrace_queues__free(&sf->queues); 1162 1163 session->auxtrace = NULL; 1163 1164 err_free: 1164 - free(sf->logdir); 1165 + zfree(&sf->logdir); 1165 1166 free(sf); 1166 1167 return err; 1167 1168 }
+5 -4
tools/perf/util/srccode.c
··· 4 4 * Copyright (c) 2017, Intel Corporation. 5 5 * Author: Andi Kleen 6 6 */ 7 - #include "linux/list.h" 7 + #include <linux/list.h> 8 + #include <linux/zalloc.h> 8 9 #include <stdlib.h> 9 10 #include <sys/mman.h> 10 11 #include <sys/stat.h> ··· 87 86 hlist_del(&sf->hash_nd); 88 87 map_total_sz -= sf->maplen; 89 88 munmap(sf->map, sf->maplen); 90 - free(sf->lines); 91 - free(sf->fn); 89 + zfree(&sf->lines); 90 + zfree(&sf->fn); 92 91 free(sf); 93 92 num_srcfiles--; 94 93 } ··· 154 153 out_map: 155 154 munmap(h->map, sz); 156 155 out_fn: 157 - free(h->fn); 156 + zfree(&h->fn); 158 157 out_h: 159 158 free(h); 160 159 return NULL;
+2 -1
tools/perf/util/stat-shadow.c
··· 8 8 #include "evlist.h" 9 9 #include "expr.h" 10 10 #include "metricgroup.h" 11 + #include <linux/zalloc.h> 11 12 12 13 /* 13 14 * AGGR_GLOBAL: Use CPU 0 ··· 776 775 print_metric(config, ctxp, NULL, NULL, "", 0); 777 776 778 777 for (i = 1; i < pctx.num_ids; i++) 779 - free((void *)pctx.ids[i].name); 778 + zfree(&pctx.ids[i].name); 780 779 } 781 780 782 781 void perf_stat__print_shadow_stats(struct perf_stat_config *config,
+1 -1
tools/perf/util/stat.c
··· 133 133 struct perf_stat_evsel *ps = evsel->stats; 134 134 135 135 if (ps) 136 - free(ps->group_data); 136 + zfree(&ps->group_data); 137 137 zfree(&evsel->stats); 138 138 } 139 139
+5 -5
tools/perf/util/symbol-elf.c
··· 2133 2133 return 0; 2134 2134 2135 2135 out_free_args: 2136 - free(tmp->args); 2136 + zfree(&tmp->args); 2137 2137 out_free_name: 2138 - free(tmp->name); 2138 + zfree(&tmp->name); 2139 2139 out_free_prov: 2140 - free(tmp->provider); 2140 + zfree(&tmp->provider); 2141 2141 out_free_note: 2142 2142 free(tmp); 2143 2143 out_err: ··· 2253 2253 2254 2254 list_for_each_entry_safe(pos, tmp, sdt_notes, note_list) { 2255 2255 list_del(&pos->note_list); 2256 - free(pos->name); 2257 - free(pos->provider); 2256 + zfree(&pos->name); 2257 + zfree(&pos->provider); 2258 2258 free(pos); 2259 2259 nr_free++; 2260 2260 }
+1 -1
tools/perf/util/thread_map.c
··· 480 480 /* 481 481 * Free the 'idx' item and shift the rest up. 482 482 */ 483 - free(threads->map[idx].comm); 483 + zfree(&threads->map[idx].comm); 484 484 485 485 for (i = idx; i < threads->nr - 1; i++) 486 486 threads->map[i] = threads->map[i + 1];
+2 -1
tools/perf/util/unwind-libunwind-local.c
··· 25 25 #include <unistd.h> 26 26 #include <sys/mman.h> 27 27 #include <linux/list.h> 28 + #include <linux/zalloc.h> 28 29 #ifndef REMOTE_UNWIND_LIBUNWIND 29 30 #include <libunwind.h> 30 31 #include <libunwind-ptrace.h> ··· 346 345 __func__, 347 346 dso->symsrc_filename, 348 347 debuglink); 349 - free(dso->symsrc_filename); 348 + zfree(&dso->symsrc_filename); 350 349 } 351 350 dso->symsrc_filename = debuglink; 352 351 } else {