Skip to content

Commit c580cc3

Browse files
committed
call mg_tcpip_free from mg_mgr_free()
1 parent 34cdce7 commit c580cc3

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

mongoose.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4127,6 +4127,9 @@ void mg_mgr_free(struct mg_mgr *mgr) {
41274127
if (mgr->epoll_fd >= 0) close(mgr->epoll_fd), mgr->epoll_fd = -1;
41284128
#endif
41294129
mg_tls_ctx_free(mgr);
4130+
#if MG_ENABLE_TCPIP
4131+
if (mgr->ifp) mg_tcpip_free(mgr->ifp);
4132+
#endif
41304133
}
41314134

41324135
void mg_mgr_init(struct mg_mgr *mgr) {
@@ -4162,7 +4165,7 @@ void mg_mgr_init(struct mg_mgr *mgr) {
41624165
#endif
41634166

41644167

4165-
#if defined(MG_ENABLE_TCPIP) && MG_ENABLE_TCPIP
4168+
#if MG_ENABLE_TCPIP
41664169
#define MG_EPHEMERAL_PORT_BASE 32768
41674170
#define PDIFF(a, b) ((size_t) (((char *) (b)) - ((char *) (a))))
41684171

src/net.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ void mg_mgr_free(struct mg_mgr *mgr) {
247247
if (mgr->epoll_fd >= 0) close(mgr->epoll_fd), mgr->epoll_fd = -1;
248248
#endif
249249
mg_tls_ctx_free(mgr);
250+
#if MG_ENABLE_TCPIP
251+
if (mgr->ifp) mg_tcpip_free(mgr->ifp);
252+
#endif
250253
}
251254

252255
void mg_mgr_init(struct mg_mgr *mgr) {

src/net_builtin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "net_builtin.h"
22

3-
#if defined(MG_ENABLE_TCPIP) && MG_ENABLE_TCPIP
3+
#if MG_ENABLE_TCPIP
44
#define MG_EPHEMERAL_PORT_BASE 32768
55
#define PDIFF(a, b) ((size_t) (((char *) (b)) - ((char *) (a))))
66

0 commit comments

Comments
 (0)