@@ -3517,6 +3517,7 @@ void tracecmd_close(struct tracecmd_input *handle)
free(handle->cpu_data);
free(handle->uname);
free(handle->trace_clock);
+ free(handle->version);
close(handle->fd);
tracecmd_free_hooks(handle->hooks);
@@ -3958,6 +3959,7 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx)
new_handle->cpu_data = NULL;
new_handle->nr_buffers = 0;
new_handle->buffers = NULL;
+ new_handle->version = NULL;
new_handle->ref = 1;
if (handle->trace_clock) {
new_handle->trace_clock = strdup(handle->trace_clock);
@@ -3970,6 +3972,7 @@ tracecmd_buffer_instance_handle(struct tracecmd_input *handle, int indx)
new_handle->parent = handle;
new_handle->cpustats = NULL;
new_handle->hooks = NULL;
+ new_handle->version = NULL;
if (handle->uname)
/* Ignore if fails to malloc, no biggy */
new_handle->uname = strdup(handle->uname);
The version string is allocated when a VERSION option is processed, but is never freed. Free it on input hanlder close. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- lib/trace-cmd/trace-input.c | 3 +++ 1 file changed, 3 insertions(+)