public inbox for [email protected]
 help / color / mirror / Atom feed
From: Marcel Holtmann <[email protected]>
To: [email protected]
Subject: [PATCH liburing] examples/io_uring-test: Fix memory leak
Date: Sun, 12 Jan 2025 19:08:30 +0100	[thread overview]
Message-ID: <[email protected]> (raw)

The iovecs structure is leaking even for the succesful case and since
everything else gets cleaned up before exit, just free the iovecs
allocated memory as well.

Signed-off-by: Marcel Holtmann <[email protected]>
---
 examples/io_uring-test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/io_uring-test.c b/examples/io_uring-test.c
index d3fcc9ef2f5d..79574636a0d7 100644
--- a/examples/io_uring-test.c
+++ b/examples/io_uring-test.c
@@ -108,5 +108,8 @@ int main(int argc, char *argv[])
 						(unsigned long) fsize);
 	close(fd);
 	io_uring_queue_exit(&ring);
+	for (i = 0; i < QD; i++)
+		free(iovecs[i].iov_base);
+	free(iovecs);
 	return 0;
 }
-- 
2.47.1


             reply	other threads:[~2025-01-12 18:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-12 18:08 Marcel Holtmann [this message]
2025-01-12 22:02 ` [PATCH liburing] examples/io_uring-test: Fix memory leak Jens Axboe

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    /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