1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-02 03:46:21 -04:00

cgi: Fix the possible memleak and close pipes in case of error.

[ Backported from commit 035ce283c7
  in ELinks 0.12.GIT.  --KON ]
This commit is contained in:
Witold Filipczyk 2007-03-01 18:51:39 +01:00 committed by Kalle Olavi Niemitalo
parent a64dd281e9
commit daf5d88405

View File

@ -352,12 +352,14 @@ execute_cgi(struct connection *conn)
}
} else { /* ELinks */
if (!init_http_connection_info(conn, 1, 0, 1))
return 0;
mem_free(script);
if (!init_http_connection_info(conn, 1, 0, 1)) {
close(pipe_read[0]); close(pipe_read[1]);
close(pipe_write[0]); close(pipe_write[1]);
return 0;
}
close(pipe_read[1]); close(pipe_write[0]);
conn->cgi_pipes[0] = pipe_read[0];
conn->cgi_pipes[1] = pipe_write[1];