Commit 7c50b26c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix three memory leaks related to vsb's not being vsb_deleted:

Two really bad ones in Vary processing, found by Arjan (noosius).

One isignificant one related to -b arguments being wrong,
found by FlexeLint after I taught it how to spot this kind of issue.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2613 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f84104d6
......@@ -69,6 +69,10 @@ VRY_Create(const struct sess *sp)
struct vsb *sb, *sbh;
unsigned l;
/* No Vary: header, no worries */
if (!http_GetHdr(sp->obj->http, H_Vary, &v))
return;
/* For vary matching string */
sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
AN(sb);
......@@ -77,10 +81,6 @@ VRY_Create(const struct sess *sp)
sbh = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
AN(sbh);
/* No Vary: header, no worries */
if (!http_GetHdr(sp->obj->http, H_Vary, &v))
return;
for (p = v; *p; p++) {
/* Find next header-name */
......@@ -130,6 +130,9 @@ VRY_Create(const struct sess *sp)
sp->obj->vary = malloc(l);
AN(sp->obj->vary);
memcpy(sp->obj->vary, vsb_data(sb), l);
vsb_delete(sb);
vsb_delete(sbh);
}
int
......
......@@ -423,6 +423,7 @@ mgt_vcc_default(const char *b_arg, const char *f_arg, int f_fd, int C_flag)
*/
free(port);
fprintf(stderr, "invalid backend address\n");
vsb_delete(sb);
return (1);
}
......
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