All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] trace-cmd: trace-cmd.c call free only once on tracing and path
@ 2015-12-03 22:34 John Kacur
  2016-02-23 22:22 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: John Kacur @ 2015-12-03 22:34 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML

>From 33102b6423ba64798d91aee9de4ecb21189dd49e Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Thu, 3 Dec 2015 23:29:05 +0100
Subject: [PATCH] trace-cmd: don't call free on tracing and path more than once

In version trace-cmd-stable-v2.2 it is possible to call free on
tracing and path more than once.

Ensure this only happens once by moving this block to after the call
to out_free

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 trace-recorder.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/trace-recorder.c b/trace-recorder.c
index 540765bc9c65..cfdc45e053ab 100644
--- a/trace-recorder.c
+++ b/trace-recorder.c
@@ -97,15 +97,15 @@ struct tracecmd_recorder *tracecmd_create_recorder_fd(int fd, int cpu, unsigned
 	if (recorder->trace_fd < 0)
 		goto out_free;
 
-	free(tracing);
-	free(path);
-
 	if ((recorder->flags & TRACECMD_RECORD_NOSPLICE) == 0) {
 		ret = pipe(recorder->brass);
 		if (ret < 0)
 			goto out_free;
 	}
 
+	free(tracing);
+	free(path);
+
 	return recorder;
 
  out_free:
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] trace-cmd: trace-cmd.c call free only once on tracing and path
  2015-12-03 22:34 [PATCH] trace-cmd: trace-cmd.c call free only once on tracing and path John Kacur
@ 2016-02-23 22:22 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2016-02-23 22:22 UTC (permalink / raw)
  To: John Kacur; +Cc: LKML

On Thu, 3 Dec 2015 23:34:13 +0100 (CET)
John Kacur <jkacur@redhat.com> wrote:

> >From 33102b6423ba64798d91aee9de4ecb21189dd49e Mon Sep 17 00:00:00 2001  
> From: John Kacur <jkacur@redhat.com>
> Date: Thu, 3 Dec 2015 23:29:05 +0100
> Subject: [PATCH] trace-cmd: don't call free on tracing and path more than once
> 
> In version trace-cmd-stable-v2.2 it is possible to call free on
> tracing and path more than once.
> 
> Ensure this only happens once by moving this block to after the call
> to out_free

Applied to upstream. I'll have to go and back port patches for the
stable releases too.

Thanks,

-- Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-23 22:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-03 22:34 [PATCH] trace-cmd: trace-cmd.c call free only once on tracing and path John Kacur
2016-02-23 22:22 ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.