From 913628e0d68564ab0f3f1e1e51902af93454effc Mon Sep 17 00:00:00 2001 From: Richard Quirk Date: Sat, 25 Jul 2015 15:03:02 +0200 Subject: Close temp file if pipe open fails --- local.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'local.c') diff --git a/local.c b/local.c index 9428319..2728627 100644 --- a/local.c +++ b/local.c @@ -386,9 +386,11 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) cgi_basename = mybasename(file); pid = open_pipe_rw(&fr, NULL); /* Don't invoke gc after here, or the program might crash in some platforms */ - if (pid < 0) + if (pid < 0) { + if (fw) + fclose(fw); return NULL; - else if (pid) { + } else if (pid) { if (fw) fclose(fw); return fr; -- cgit v1.2.3