Commit 4eb2e253 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Move malloc() / free() out of the loop, and plug a leak. Ideally, we

shouldn't need to malloc() / free() at all, but I don't have time to
figure out how to avoid it right now.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2126 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 30238c1c
......@@ -298,18 +298,19 @@ Fetch(struct sess *sp)
if (http_GetHdr(sp->http, H_Content_Length, &ptr)) {
content_length = strtoul(ptr, &endp, 10);
/* XXX should check result of conversion */
while (content_length) {
p = malloc(content_length);
while (content_length) {
read = HTC_Read(sp->htc, p, content_length);
WRK_Write(w, p, read);
if (WRK_Flush(w)) {
VBE_UpdateHealth(sp, vc, -1);
VBE_ClosedFd(sp->wrk, vc);
free(p);
return (__LINE__);
}
content_length -= read;
free(p);
}
free(p);
}
if (WRK_Flush(w)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment