1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

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

This commit is contained in:
Witold Filipczyk 2007-03-01 18:51:39 +01:00 committed by Kalle Olavi Niemitalo
parent 9179c8d3f6
commit 035ce283c7

View File

@ -373,12 +373,14 @@ execute_cgi(struct connection *conn)
} }
} else { /* ELinks */ } else { /* ELinks */
if (!init_http_connection_info(conn, 1, 0, 1))
return 0;
mem_free(script); 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]); close(pipe_read[1]); close(pipe_write[0]);
conn->socket->fd = pipe_read[0]; conn->socket->fd = pipe_read[0];