From 78b3a304479ac3063bf75d41ed25539ed474763d Mon Sep 17 00:00:00 2001 From: default Date: Tue, 25 Oct 2022 13:59:15 +0200 Subject: Some code moving to avoid false positive leaks. --- httpd.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'httpd.c') diff --git a/httpd.c b/httpd.c index d7fad93..726cb37 100644 --- a/httpd.c +++ b/httpd.c @@ -183,10 +183,8 @@ void httpd_connection(FILE *f) b_size = strlen(body); /* if it was a HEAD, no body will be sent */ - if (strcmp(method, "HEAD") == 0) { - free(body); - body = NULL; - } + if (strcmp(method, "HEAD") == 0) + body = xs_free(body); xs_httpd_response(f, status, headers, body, b_size); @@ -194,7 +192,7 @@ void httpd_connection(FILE *f) srv_archive("RECV", req, payload, p_size, status, headers, body, b_size); - free(body); + xs_free(body); } @@ -233,18 +231,21 @@ static void *queue_thread(void *arg) srv_log(xs_fmt("queue thread start")); while (srv_running) { - xs *list = user_list(); - char *p, *uid; time_t t; - /* process queues for all users */ - p = list; - while (xs_list_iter(&p, &uid)) { - snac snac; + { + xs *list = user_list(); + char *p, *uid; + + /* process queues for all users */ + p = list; + while (xs_list_iter(&p, &uid)) { + snac snac; - if (user_open(&snac, uid)) { - process_queue(&snac); - user_free(&snac); + if (user_open(&snac, uid)) { + process_queue(&snac); + user_free(&snac); + } } } -- cgit v1.2.3