mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] trace-cmd: trace-cmd.c call free only once on tracing and path
Date: Thu, 3 Dec 2015 23:34:13 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.20.1512032331580.20385@riemann> (raw)

>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


             reply	other threads:[~2015-12-03 22:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 22:34 John Kacur [this message]
2016-02-23 22:22 ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.20.1512032331580.20385@riemann \
    --to=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®