From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: io-uring Mailing List <[email protected]>,
Ammar Faizi <[email protected]>
Subject: [PATCH liburing] test/probe: Use `io_uring_free_probe()` instead of `free()`
Date: Sun, 3 Oct 2021 08:06:08 +0700 [thread overview]
Message-ID: <[email protected]> (raw)
`io_uring_free_probe()` should really be used to free the return value
of `io_uring_get_probe_ring()`. As we may not always allocate it with
`malloc()`. For example, to support no libc build [1].
Link: https://github.com/axboe/liburing/issues/443 [1]
Signed-off-by: Ammar Faizi <[email protected]>
---
test/probe.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/test/probe.c b/test/probe.c
index 29239ff..fd59612 100644
--- a/test/probe.c
+++ b/test/probe.c
@@ -45,6 +45,7 @@ static int verify_probe(struct io_uring_probe *p, int full)
static int test_probe_helper(struct io_uring *ring)
{
+ int ret;
struct io_uring_probe *p;
p = io_uring_get_probe_ring(ring);
@@ -53,12 +54,9 @@ static int test_probe_helper(struct io_uring *ring)
return 1;
}
- if (verify_probe(p, 1)) {
- free(p);
- return 1;
- }
-
- return 0;
+ ret = verify_probe(p, 1);
+ io_uring_free_probe(p);
+ return ret;
}
static int test_probe(struct io_uring *ring)
--
2.30.2
next reply other threads:[~2021-10-03 1:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-03 1:06 Ammar Faizi [this message]
2021-10-03 13:06 ` [PATCH liburing] test/probe: Use `io_uring_free_probe()` instead of `free()` 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 \
--in-reply-to=20211003010608.58380-1-ammar.faizi@students.amikom.ac.id \
[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