1
0
mirror of https://git.sr.ht/~sircmpwn/gmni synced 2024-11-23 04:51:59 +01:00

gmnlm: Fix segfault when local file does not exist

This commit is contained in:
Callum Brown 2020-10-06 17:53:56 +01:00 committed by Drew DeVault
parent 7619edcd11
commit 40308b8b0b

@ -759,6 +759,13 @@ do_requests(struct browser *browser, struct gemini_response *resp)
FILE *fp = fopen(path, "r");
if (!fp) {
resp->status = GEMINI_STATUS_NOT_FOUND;
/* Make sure members of resp evaluate to false, so that
gemini_response_finish does not try to free them. */
resp->bio = NULL;
resp->ssl = NULL;
resp->ssl_ctx = NULL;
resp->meta = NULL;
resp->fd = -1;
free(path);
break;
}