Update ssl_RemoveSession to use existing RemoveSession function

Co-Authored-By: lealem@wolfssl.com <lealem@wolfssl.com>
This commit is contained in:
Devin AI
2025-05-14 16:28:21 +00:00
parent 4cfaef7c30
commit 61bb5624f4

View File

@@ -7631,7 +7631,6 @@ int ssl_RemoveSession(const char* clientIp, int clientPort,
IpAddrInfo clientAddr = {0}; IpAddrInfo clientAddr = {0};
IpAddrInfo serverAddr = {0}; IpAddrInfo serverAddr = {0};
SnifferSession* session; SnifferSession* session;
SnifferSession* previous = NULL;
int ret = -1; /* Default to not found */ int ret = -1; /* Default to not found */
word32 i; word32 i;
@@ -7688,7 +7687,6 @@ int ssl_RemoveSession(const char* clientIp, int clientPort,
/* Search through all rows in the session table */ /* Search through all rows in the session table */
for (i = 0; i < HASH_SIZE; i++) { for (i = 0; i < HASH_SIZE; i++) {
previous = NULL;
session = SessionTable[i]; session = SessionTable[i];
while (session) { while (session) {
@@ -7700,21 +7698,12 @@ int ssl_RemoveSession(const char* clientIp, int clientPort,
session->cliPort == clientPort && session->cliPort == clientPort &&
session->srvPort == serverPort) { session->srvPort == serverPort) {
/* Remove the session from the linked list */ /* Use RemoveSession to remove and free the session */
if (previous) { RemoveSession(session, NULL, NULL, i);
previous->next = session->next;
}
else {
SessionTable[i] = session->next;
}
/* Free the session */
FreeSnifferSession(session);
ret = 0; /* Session found and freed */ ret = 0; /* Session found and freed */
break; break;
} }
previous = session;
session = next; session = next;
} }