Skip to contentSkip to conversation

examples/io_uring-test: Fix memory leak

PATCH Applied Marcel Holtmann 2 participants 2 messages Jan 12, 2025 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/io_uring-test: Fix memory leak

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.

---
 examples/io_uring-test.c | 3 +++
 1 file changed, 3 insertions(+)
examples/io_uring-test.c +3 -0
index d3fcc9ef2f5d..79574636a0d7 100644
@@ -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;
 }
Signature · 1 line
2.47.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Marcel Holtmann

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.

Applied, thanks!

[1/1] examples/io_uring-test: Fix memory leak

      commit: 3124a4619e4daf26b06d48ccf0186a947070c415

Best regards,

Signature · 1 line
Jens Axboe