Skip to content

Commit 09a3477

Browse files
committed
fix: fix memory leak during network disconnect
1 parent 59c8bba commit 09a3477

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

network/network.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ int network_init(network_t *n, const char *host, const char *port, const char *c
7373
void network_release(network_t* n)
7474
{
7575
if (n->socket >= 0)
76+
{
7677
network_disconnect(n);
77-
78-
memset(n, 0, sizeof(network_t));
78+
memset(n, 0, sizeof(network_t));
79+
}
7980
}
8081

8182
void network_set_channel(network_t *n, int channel)

0 commit comments

Comments
 (0)