38 lines
907 B
Diff
38 lines
907 B
Diff
From f63f1404ab96bfaa357a89c8e91cb65a357eb761 Mon Sep 17 00:00:00 2001
|
|
From: hankangkang <hankangkang5@huawei.com>
|
|
Date: Mon, 2 Dec 2024 16:31:57 +0800
|
|
Subject: [PATCH] bug: free sock when func goto out
|
|
|
|
---
|
|
src/api/lwipgz_sock.c | 8 +++++---
|
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/api/lwipgz_sock.c b/src/api/lwipgz_sock.c
|
|
index 5419057..401c523 100644
|
|
--- a/src/api/lwipgz_sock.c
|
|
+++ b/src/api/lwipgz_sock.c
|
|
@@ -119,15 +119,17 @@ int gazelle_alloc_socket(struct netconn *newconn, int accepted, int flags)
|
|
return fd;
|
|
|
|
out:
|
|
- if (sock != NULL)
|
|
- sock->conn = NULL;
|
|
- posix_api->close_fn(fd);
|
|
+ gazelle_free_socket(sock, fd);
|
|
return -1;
|
|
}
|
|
|
|
/* reference tag: free_socket() */
|
|
void gazelle_free_socket(struct lwip_sock *sock, int fd)
|
|
{
|
|
+ if (sock != NULL) {
|
|
+ sock->conn = NULL;
|
|
+ }
|
|
+
|
|
do_lwip_clean_sock(fd);
|
|
posix_api->close_fn(fd);
|
|
}
|
|
--
|
|
2.33.0
|
|
|