diff mbox series

[6/7] trace-cmd: Fix memory leak in stop_mapping_vcpus()

Message ID 20241205144439.127564-7-jmarchan@redhat.com (mailing list archive)
State Accepted
Commit fee20bfb262fe09c0e6bce73726c61d51cbca7a3
Headers show
Series trace-cmd: Fix misc issues uncoverd by static analysis | expand

Commit Message

Jerome Marchand Dec. 5, 2024, 2:44 p.m. UTC
In stop_mapping_vcpus(), tmap.vcpu is allocated in map_kvm_vcpus() but
not freed in the error path.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 tracecmd/trace-tsync.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/tracecmd/trace-tsync.c b/tracecmd/trace-tsync.c
index 57baff39..834b4da4 100644
--- a/tracecmd/trace-tsync.c
+++ b/tracecmd/trace-tsync.c
@@ -258,6 +258,7 @@  static void stop_mapping_vcpus(int cpu_count, struct trace_guest *guest)
  out_free:
 	tep_free(tep);
  out:
+	free(tmap.vcpu);
 	free(tmap.map);
 	tracefs_instance_destroy(guest->instance);
 	tracefs_instance_free(guest->instance);