public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Joerg Vehlow <lkml@jv-coder.de>
To: ltp@lists.linux.it, bogdan.lezhepekov@suse.com
Cc: Joerg Vehlow <joerg.vehlow@aox-tech.de>
Subject: [LTP] [PATCH 2/3] realtime/librttest: Fix memory leaks
Date: Mon, 15 Nov 2021 09:15:25 +0100	[thread overview]
Message-ID: <20211115081526.384856-3-lkml@jv-coder.de> (raw)
In-Reply-To: <20211115081526.384856-1-lkml@jv-coder.de>

From: Joerg Vehlow <joerg.vehlow@aox-tech.de>

Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
---
 testcases/realtime/lib/librttest.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/realtime/lib/librttest.c b/testcases/realtime/lib/librttest.c
index 89e2bfc6e..eaa623b72 100644
--- a/testcases/realtime/lib/librttest.c
+++ b/testcases/realtime/lib/librttest.c
@@ -226,6 +226,8 @@ int rt_init_long(const char *options, const struct option *longopts,
 
 	calibrate_busyloop();
 
+	free(all_options);
+
 	/*
 	 * atexit() order matters here - buffer_print() will be called before
 	 * buffer_fini().
@@ -378,6 +380,7 @@ void join_thread(int i)
 		if (t->pthread)
 			pthread_join(t->pthread, NULL);
 		list_del(&t->_threads);
+		free(t);
 	}
 }
 
@@ -397,6 +400,7 @@ void join_threads(void)
 		if (p->pthread)
 			pthread_join(p->pthread, NULL);
 		list_del(&p->_threads);
+		free(p);
 	}
 }
 
-- 
2.25.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2021-11-15  8:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  8:15 [LTP] (no subject) Joerg Vehlow
2021-11-15  8:15 ` [LTP] [PATCH 1/3] realtime/librttest: Fix functions with empty parameters Joerg Vehlow
2021-11-15 15:04   ` Cyril Hrubis
2021-11-15  8:15 ` Joerg Vehlow [this message]
2021-11-15 15:04   ` [LTP] [PATCH 2/3] realtime/librttest: Fix memory leaks Cyril Hrubis
2021-11-15  8:15 ` [LTP] [PATCH 3/3] realtime/matrix_mult: Fix test optimization Joerg Vehlow
2021-11-15 15:22   ` Cyril Hrubis
2021-11-15 15:28     ` Joerg Vehlow
2021-11-15 15:40       ` Cyril Hrubis

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=20211115081526.384856-3-lkml@jv-coder.de \
    --to=lkml@jv-coder.de \
    --cc=bogdan.lezhepekov@suse.com \
    --cc=joerg.vehlow@aox-tech.de \
    --cc=ltp@lists.linux.it \
    /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