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 <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Anna Henningsen 2020-05-07 03:49:24 +02:00
parent 7ccea60b1f
commit 55dede5b6f
No known key found for this signature in database
GPG Key ID: A94130F0BFC8EBE9

View File

@ -106,6 +106,8 @@ fail_rwlock_init:
fail_signal_init:
uv__platform_loop_delete(loop);
uv__free(loop->watchers);
loop->nwatchers = 0;
return err;
}