From 88a85fb36a4a43422c37446728edb516c18ba2a2 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Wed, 14 Mar 2018 18:49:25 +0100 Subject: [PATCH] fix free error --- http_server.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/http_server.c b/http_server.c index c8bf92f..e50accd 100644 --- a/http_server.c +++ b/http_server.c @@ -14,6 +14,9 @@ void accept_request(void* client) char path[1024]; char* token; char *line; + char* oldurl = NULL; + char* tmp = NULL; + dictionary rq = NULL; size_t i, j; struct stat st; @@ -55,12 +58,12 @@ void accept_request(void* client) - char* oldurl = strdup(url); - char* tmp = strchr(oldurl,'?'); + oldurl = strdup(url); + tmp = strchr(oldurl,'?'); if(tmp) *tmp = '\0'; - dictionary rq = decode_request(client, method, url); + rq = decode_request(client, method, url); if(rq == NULL) { badrequest(client);