Fix leak in evconnlistener_new_async()

This commit is contained in:
zhangyaqi 2024-10-18 04:23:58 +08:00
parent a7b7383811
commit cca111f05d
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From f9939490ebdba403462b6839d29fdc6837d8a0ec Mon Sep 17 00:00:00 2001
From: Azat Khuzhin <azat@libevent.org>
Date: Sun, 18 Feb 2024 21:19:41 +0100
Subject: [PATCH] Fix leak in evconnlistener_new_async()
Fixes: https://github.com/libevent/libevent/issues/414
---
listener.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/listener.c b/listener.c
index f5c00c9..01dc41d 100644
--- a/listener.c
+++ b/listener.c
@@ -885,8 +885,11 @@ evconnlistener_new_async(struct event_base *base,
return &lev->base;
err_free_accepting:
+ for (i = 0; i < lev->n_accepting; ++i) {
+ if (lev->accepting[i])
+ free_and_unlock_accepting_socket(lev->accepting[i]);
+ }
mm_free(lev->accepting);
- /* XXXX free the other elements. */
err_delete_lock:
EVTHREAD_FREE_LOCK(lev->base.lock, EVTHREAD_LOCKTYPE_RECURSIVE);
err_free_lev:
--
2.27.0

View File

@ -1,6 +1,6 @@
Name: libevent
Version: 2.1.12
Release: 5
Release: 6
Summary: An event notification library
License: BSD
@ -13,6 +13,7 @@ Patch0: libevent-nonettests.patch
Patch1: http-add-callback-to-allow-server-to-decline-and-the.patch
Patch6000: backport-evutil-don-t-call-memset-before-memcpy.patch
Patch6001: backport-Fix-potential-Null-pointer-dereference-in-regress_fi.patch
Patch6002: backport-Fix-leak-in-evconnlistener_new_async.patch
%description
Libevent additionally provides a sophisticated framework for buffered network IO, with support for sockets,
@ -70,6 +71,9 @@ rm -f %{buildroot}%{_libdir}/*.la
%changelog
* Sun Oct 27 2024 zhangyaqi <zhangyaqi@kylinos.cn> - 2.1.12-6
- Fix leak in evconnlistener_new_async()
* Wed Jul 03 2024 zhangxianting <zhangxianting@uniontech.com> - 2.1.12-5
- Type:bugfix
- CVE:NA