[PATCH liburing] test/probe: Use `io_uring_free_probe()` instead of `free()`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



`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@xxxxxxxxxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux