From 55dede5b6f730882d79f994138f0f23a7b28b119 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 7 May 2020 03:49:24 +0200 Subject: [PATCH] unix: fix memory leak when uv_loop_init() fails `uv_signal_init()` leads to the allocation of an IO watcher, so if the loop initialization fails at a later point, the `loop->watchers` list needs to be released. PR-URL: https://github.com/libuv/libuv/pull/2837 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno --- src/unix/loop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/unix/loop.c b/src/unix/loop.c index c2a03d77..e5b28895 100644 --- a/src/unix/loop.c +++ b/src/unix/loop.c @@ -106,6 +106,8 @@ fail_rwlock_init: fail_signal_init: uv__platform_loop_delete(loop); + uv__free(loop->watchers); + loop->nwatchers = 0; return err; }