Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Free dynamically allocated memory before returning on errors
Signed-off-by: Adam Piątyszek <ediap@users.sourceforge.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Adam Piątyszek authored and David Woodhouse committed Feb 22, 2010
1 parent cc09a51 commit a443fad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion http.c
Expand Up @@ -213,6 +213,7 @@ static int process_http_response(struct openconnect_info *vpninfo, int *result,
i = SSL_read(vpninfo->https_ssl, body + done, bodylen - done);
if (i < 0) {
vpninfo->progress(vpninfo, PRG_ERR, "Error reading HTTP response body\n");
free(body);
return -EINVAL;
}
done += i;
Expand All @@ -238,6 +239,7 @@ static int process_http_response(struct openconnect_info *vpninfo, int *result,
i = SSL_read(vpninfo->https_ssl, body + done, chunklen);
if (i < 0) {
vpninfo->progress(vpninfo, PRG_ERR, "Error reading HTTP response body\n");
free(body);
return -EINVAL;
}
chunklen -= i;
Expand All @@ -251,9 +253,10 @@ static int process_http_response(struct openconnect_info *vpninfo, int *result,
vpninfo->progress(vpninfo, PRG_ERR, "Error in chunked decoding. Expected '', got: '%s'",
buf);
}
free(body);
return -EINVAL;
}

if (lastchunk)
break;
}
Expand Down

0 comments on commit a443fad

Please sign in to comment.