summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmmar Faizi <ammar.faizi@students.amikom.ac.id>2021-10-03 08:06:08 +0700
committerJens Axboe <axboe@kernel.dk>2021-10-03 07:05:37 -0600
commit834496358870cb272f98cf22b3fe0307c83a526d (patch)
tree47a67c560f7be3f845ef2fcf6f53d1cb6f5dcdfc
parentce10538688b93dafd257ebfed7faf18844e0052d (diff)
downloadliburing-834496358870cb272f98cf22b3fe0307c83a526d.tar.gz
liburing-834496358870cb272f98cf22b3fe0307c83a526d.tar.bz2
test/probe: Use `io_uring_free_probe()` instead of `free()`
`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 <ammar.faizi@students.amikom.ac.id> Link: https://lore.kernel.org/r/20211003010608.58380-1-ammar.faizi@students.amikom.ac.id Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--test/probe.c10
1 files 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)