diff --git a/src/gmnlm.c b/src/gmnlm.c
index 0546486340b7299be3c97266dd534a1354bf31a3..d05180c7a74c88bd7ed8ba551a4a522bb8b74009 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -759,6 +759,13 @@
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;
}