All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kurt Kanzenbach <kurt@linutronix.de>
To: Clark Williams <williams@redhat.com>, John Kacur <jkacur@redhat.com>
Cc: rt-users <linux-rt-users@vger.kernel.org>,
	Kurt Kanzenbach <kurt@linutronix.de>
Subject: [PATCH 4/4] rt-tests: deadline_test: add missing frees
Date: Thu,  4 Apr 2019 15:48:14 +0200	[thread overview]
Message-ID: <20190404134814.13376-5-kurt@linutronix.de> (raw)
In-Reply-To: <20190404134814.13376-1-kurt@linutronix.de>

The threads and thread data structures are allocated using calloc(). But never
free'd. So, free them.

While here, remove the if statement for setcpu_buf. Free() is NULL safe.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 src/sched_deadline/deadline_test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index 4826557d0624..69e6fd18b73b 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -2092,8 +2092,9 @@ int main (int argc, char **argv)
 		printf("\n");
 	}
 
-	if (!setcpu_buf)
-		free(setcpu_buf);
+	free(thread);
+	free(sched_data);
+	free(setcpu_buf);
 
 	return 0;
 }
-- 
2.11.0


  parent reply	other threads:[~2019-04-04 13:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04 13:48 [PATCH 0/4] rt-tests: deadline: Fix segmentation faults Kurt Kanzenbach
2019-04-04 13:48 ` [PATCH 1/4] rt-tests: cyclicdeadline: fix segmentation fault on close Kurt Kanzenbach
2019-04-05 14:33   ` John Kacur
2019-04-04 13:48 ` [PATCH 2/4] rt-tests: cyclicdeadline: add missing free calls Kurt Kanzenbach
2019-04-05 14:34   ` John Kacur
2019-04-04 13:48 ` [PATCH 3/4] rt-tests: deadline_tests: fix stack buffer flow Kurt Kanzenbach
2019-04-05 14:35   ` John Kacur
2019-04-04 13:48 ` Kurt Kanzenbach [this message]
2019-04-04 15:13   ` [PATCH 4/4] rt-tests: deadline_test: add missing frees John Kacur
2019-04-04 15:19     ` Kurt Kanzenbach
2019-04-04 15:42       ` John Kacur
2019-04-05 14:36   ` John Kacur

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=20190404134814.13376-5-kurt@linutronix.de \
    --to=kurt@linutronix.de \
    --cc=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /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 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.