misc fixes

This commit is contained in:
Andrew Pamment 2018-01-23 21:16:36 +10:00
parent 84a3d271df
commit d694b22b8d

View File

@ -831,7 +831,7 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
filename = www_decode_hash(&url[7]); filename = www_decode_hash(&url[7]);
if (filename != NULL) { if (filename != NULL) {
if (stat(filename, &s) == 0 && S_ISREG(s.st_mode)) { if (stat(filename, &s) == 0 && S_ISREG(s.st_mode)) {
fno = open(buffer, O_RDONLY); fno = open(filename, O_RDONLY);
if (fno != -1) { if (fno != -1) {
response = MHD_create_response_from_fd(s.st_size, fno); 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); MHD_destroy_response (response);
free(header); free(header);
free(footer); free(footer);
free(filename);
return ret; return ret;
} }
} }