diff options
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r-- | tools/perf/util/probe-event.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 2e665cb84055..e72f05c3bef0 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -1606,8 +1606,10 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, | |||
1606 | 1606 | ||
1607 | /* Init vmlinux path */ | 1607 | /* Init vmlinux path */ |
1608 | ret = init_vmlinux(); | 1608 | ret = init_vmlinux(); |
1609 | if (ret < 0) | 1609 | if (ret < 0) { |
1610 | free(pkgs); | ||
1610 | return ret; | 1611 | return ret; |
1612 | } | ||
1611 | 1613 | ||
1612 | /* Loop 1: convert all events */ | 1614 | /* Loop 1: convert all events */ |
1613 | for (i = 0; i < npevs; i++) { | 1615 | for (i = 0; i < npevs; i++) { |
@@ -1625,10 +1627,13 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, | |||
1625 | ret = __add_probe_trace_events(pkgs[i].pev, pkgs[i].tevs, | 1627 | ret = __add_probe_trace_events(pkgs[i].pev, pkgs[i].tevs, |
1626 | pkgs[i].ntevs, force_add); | 1628 | pkgs[i].ntevs, force_add); |
1627 | end: | 1629 | end: |
1628 | /* Loop 3: cleanup trace events */ | 1630 | /* Loop 3: cleanup and free trace events */ |
1629 | for (i = 0; i < npevs; i++) | 1631 | for (i = 0; i < npevs; i++) { |
1630 | for (j = 0; j < pkgs[i].ntevs; j++) | 1632 | for (j = 0; j < pkgs[i].ntevs; j++) |
1631 | clear_probe_trace_event(&pkgs[i].tevs[j]); | 1633 | clear_probe_trace_event(&pkgs[i].tevs[j]); |
1634 | free(pkgs[i].tevs); | ||
1635 | } | ||
1636 | free(pkgs); | ||
1632 | 1637 | ||
1633 | return ret; | 1638 | return ret; |
1634 | } | 1639 | } |