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:
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user