From ccc5b07ddfe3b24e6b21f5550f7a9b582250ab1e Mon Sep 17 00:00:00 2001 From: structix Date: Mon, 18 Sep 2017 21:38:51 +0200 Subject: [PATCH] #12 fixed memory leak. Enabled -O3 flag --- RestServer/main.c | 2 ++ RestServer/makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RestServer/main.c b/RestServer/main.c index 29e7a68..d3c0b02 100644 --- a/RestServer/main.c +++ b/RestServer/main.c @@ -108,6 +108,7 @@ int callback_absTempHum(const struct _u_request *request, struct _u_response *re insertData(1, temphum[0], temphum[1], 0); ulfius_set_string_body_response(response, 200, response_body); + free(response_body); //o_free(url_params); return U_CALLBACK_CONTINUE; } @@ -125,6 +126,7 @@ int callback_calcAbsTempHum(const struct _u_request *request, struct _u_response char *response_body = msprintf("%f", absoluteHumidityFloat(temphum[0], temphum[1])); ulfius_set_string_body_response(response, 200, response_body); + free(response_body); //o_free(url_params); return U_CALLBACK_CONTINUE; } diff --git a/RestServer/makefile b/RestServer/makefile index 16bc654..43f0bcd 100644 --- a/RestServer/makefile +++ b/RestServer/makefile @@ -3,7 +3,7 @@ VERSION = 1.0 CC = cc -CFLAGS = -Wall -g -D_GNU_SOURCE -D_REENTRANT -DVERSION=\"$(VERSION)\" `mysql_config --cflags` +CFLAGS = -Wall -O3 -D_GNU_SOURCE -D_REENTRANT -DVERSION=\"$(VERSION)\" `mysql_config --cflags` #LDFLAGS = -lm -lpthread `gtk-config --cflags` `gtk-config --libs` -lgthread LDFLAGS = `mysql_config --libs` -lm -lulfius -lyder -lorcania