1
0
Fork 1

Fix memory leaks

This commit is contained in:
Tom Lebreux 2020-11-07 00:09:42 -05:00 committed by Drew DeVault
parent d484ba0ab0
commit 4f12abfbc2
2 changed files with 5 additions and 0 deletions

View File

@ -71,6 +71,8 @@ mime_init()
free(mime);
}
free(line);
fclose(f);
qsort(mimedb, mimedb_ln, sizeof(mimedb[0]), mimedb_compar);
}

View File

@ -375,6 +375,7 @@ serve_request(struct gmnisrv_client *client)
if (!route) {
client_submit_response(client,
GEMINI_STATUS_NOT_FOUND, "Not found", NULL);
free(url_path);
return;
}
@ -390,6 +391,7 @@ serve_request(struct gmnisrv_client *client)
if ((size_t)n >= sizeof(real_path)) {
client_submit_response(client, GEMINI_STATUS_PERMANENT_FAILURE,
"Request path exceeds PATH_MAX", NULL);
free(url_path);
return;
}
strcpy(client_path, client->path);
@ -426,6 +428,7 @@ serve_request(struct gmnisrv_client *client)
client_submit_response(client,
GEMINI_STATUS_NOT_FOUND, "Not found", NULL);
free(url_path);
return;
}