[PATCH] server: Avoid leaking "acceptsock" on allocation failure.

Zebediah Figura z.figura12 at gmail.com
Thu Jan 21 18:16:42 CST 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 server/sock.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/sock.c b/server/sock.c
index 5f207e7f180..8c146a0a8f8 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -1473,7 +1473,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
             return 0;
         }
 
-        if (!(req = alloc_accept_req( acceptsock, async, params ))) return 0;
+        if (!(req = alloc_accept_req( acceptsock, async, params )))
+        {
+            release_object( acceptsock );
+            return 0;
+        }
         list_add_tail( &sock->accept_list, &req->entry );
         acceptsock->accept_recv_req = req;
         release_object( acceptsock );
-- 
2.29.2




More information about the wine-devel mailing list