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

decompress_data: Do not leak memory in mem_realloc.

This commit is contained in:
Witold Filipczyk 2008-02-18 17:43:34 +01:00 committed by Kalle Olavi Niemitalo
parent 902522fbdf
commit 26607d2263

View File

@ -1014,6 +1014,8 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
}
do {
unsigned char *tmp;
if (state == NORMAL) {
/* ... we aren't finishing yet. */
int written = safe_write(conn->stream_pipes[1], data, len);
@ -1050,8 +1052,9 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
if (!conn->stream) return NULL;
}
output = (unsigned char *) mem_realloc(output, *new_len + BIG_READ);
if (!output) break;
tmp = mem_realloc(output, *new_len + BIG_READ);
if (!tmp) break;
output = tmp;
did_read = read_encoded(conn->stream, output + *new_len, BIG_READ);