we wrongly free `tmp_evts[DIR_RD]` in error case.

it could be backported from v1.8 to v2.1.

Fixes: d4604adeaa8c ("MAJOR: threads/fd: Make fd stuffs thread-safe")
Signed-off-by: William Dauchy <w.dau...@criteo.com>
---
 src/ev_select.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ev_select.c b/src/ev_select.c
index acfdbb94a..167bb7eb7 100644
--- a/src/ev_select.c
+++ b/src/ev_select.c
@@ -226,13 +226,13 @@ static int init_select_per_thread()
 
        fd_set_bytes = sizeof(fd_set) * (global.maxsock + FD_SETSIZE - 1) / 
FD_SETSIZE;
        if ((tmp_evts[DIR_RD] = (fd_set *)calloc(1, fd_set_bytes)) == NULL)
-               goto fail;
+               goto fail_rd;
        if ((tmp_evts[DIR_WR] = (fd_set *)calloc(1, fd_set_bytes)) == NULL)
-               goto fail;
+               goto fail_wr;
        return 1;
-  fail:
+  fail_wr:
        free(tmp_evts[DIR_RD]);
-       free(tmp_evts[DIR_WR]);
+  fail_rd:
        return 0;
 }
 
-- 
2.26.2


Reply via email to