From d694b22b8dfe39c5002aee0f42957d0048f64aa1 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Tue, 23 Jan 2018 21:16:36 +1000 Subject: [PATCH] misc fixes --- src/www.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/www.c b/src/www.c index 214f34d..91e221b 100644 --- a/src/www.c +++ b/src/www.c @@ -831,7 +831,7 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url filename = www_decode_hash(&url[7]); if (filename != NULL) { if (stat(filename, &s) == 0 && S_ISREG(s.st_mode)) { - fno = open(buffer, O_RDONLY); + fno = open(filename, O_RDONLY); if (fno != -1) { response = MHD_create_response_from_fd(s.st_size, fno); @@ -844,6 +844,7 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url MHD_destroy_response (response); free(header); free(footer); + free(filename); return ret; } }