aboutsummaryrefslogtreecommitdiff
path: root/handler.c
diff options
context:
space:
mode:
authorxavi <xavi@noreply.localhost>2023-11-20 16:27:28 +0100
committerxavi <xavi@noreply.localhost>2023-11-20 16:27:28 +0100
commit8f1ad3124e9e063ca0ee7c2548c747b20de3529d (patch)
tree79eb2d6be52357eecf59634af99a6552184fe731 /handler.c
parent44676b84fd9aa689e4abbb588bead19a36061fa1 (diff)
parent59a67a7541ee1559b140494c21a25b195246a4fa (diff)
Merge pull request 'Fix double-free on failed `server_client_close`' (#2) from midokura-xavi/libweb:fix-double-free into master
Reviewed-on: https://gitea.privatedns.org/xavi/libweb/pulls/2
Diffstat (limited to 'handler.c')
-rw-r--r--handler.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/handler.c b/handler.c
index 4abbdb8..f400f2b 100644
--- a/handler.c
+++ b/handler.c
@@ -152,13 +152,13 @@ static void client_free(struct client *const c)
static int remove_client_from_list(struct handler *const h,
struct client *const c)
{
- int ret = -1;
+ int ret = 0;
if (server_client_close(h->server, c->c))
{
fprintf(stderr, "%s: server_client_close failed\n",
__func__);
- goto end;
+ ret = -1;
}
for (struct client *cl = h->clients, *prev = NULL; cl;
@@ -175,9 +175,6 @@ static int remove_client_from_list(struct handler *const h,
}
}
- ret = 0;
-
-end:
client_free(c);
return ret;
}