On 7/13/2023 1:03 PM, Richard W.M. Jones wrote:
On Thu, Jul 13, 2023 at 09:53:58AM +0000, Tage Johansson wrote:
Apologize if resending, but I'm not sure my previous email was
actually delivered.


On 7/12/2023 10:33 PM, Eric Blake wrote:


On Wed, Jul 12, 2023 at 03:19:59PM +0000, Tage Johansson wrote:
Hello,


While writing some tests for the Rust bindings, I discovered a
memory leak
with Valgrind due to a completion callback not being freed. More
specificly,
the completion callback of `aio_opt_info()` doesn't seem to be if
`aio_opt_info()` failes. In this case, `aio_opt_info()` was called in the
connected state, so it should indeed fail, but it should perhaps
also call
the free function associated with the callback.
Can you paste the valgrind output showing the leak?

The Valgrind output is very Rust specific and only shows the Rust
allocations which goes into the completion callback and are lost.


But if you apply the following patch (which modifies
tests/opt-info.c) you shall see that the completion callback is not
called.

I have replaced a call to `nbd_opt_info()` with a call to
`nbd_aio_opt_info()` and passed in a completion callback which just
calls `exit(EXIT_FAILURE)`. So if the completion callback is called
the test should fail, which it doesn't, at least not on my machine.
Isn't that OK?  Only .free is required to be called.


Of course, you are right. I will continue investigating why my Rust closure isn't freed though.


Best regards,

Tage


_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to