[PATCH v6 resend 03/10] server: Ensure completion_callback is called before async is destroyed.
Jinoh Kang
jinoh.kang.kr at gmail.com
Fri Mar 18 12:47:24 CDT 2022
async_set_result() is the only way the async completion callback can be
called. If the async were never queued (e.g. if it is a request async,
and it failed in a very early stage), it could be destroyed without its
completion callback ever being called. This leads to memory leak.
Fix this by calling the completion_callback if it was not already called
and then set to NULL.
Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
Notes:
v4 -> v5: new patch
v5 -> v6: no changes
server/async.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/server/async.c b/server/async.c
index d49fb8b7c04..3e5ca7ccf8c 100644
--- a/server/async.c
+++ b/server/async.c
@@ -144,6 +144,10 @@ static void async_destroy( struct object *obj )
struct async *async = (struct async *)obj;
assert( obj->ops == &async_ops );
+ if (async->completion_callback)
+ async->completion_callback( async->completion_callback_private );
+ async->completion_callback = NULL;
+
list_remove( &async->process_entry );
if (async->queue)
--
2.34.1
More information about the wine-devel
mailing list