]> err.no Git - varnish/commitdiff
Be much more BOFH about bereq, more asserts, free them where they
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 19 Jan 2009 12:58:44 +0000 (12:58 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 19 Jan 2009 12:58:44 +0000 (12:58 +0000)
obviously should be freed.

This could fix 421 or make it much worse, but give us more info.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3530 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_fetch.c
varnish-cache/bin/varnishd/cache_http.c
varnish-cache/bin/varnishd/cache_pipe.c

index f2445649aa9db4624759402744cdedd58358cf53..437acb8e7a205fd8130ce36658d11667b2986b27 100644 (file)
@@ -155,6 +155,8 @@ cnt_deliver(struct sess *sp)
        CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
        CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
 
+       AZ(sp->bereq);
+
        sp->t_resp = TIM_real();
        if (sp->obj->objhead != NULL) {
                sp->obj->last_use = sp->t_resp; /* XXX: locking ? */
@@ -301,6 +303,7 @@ cnt_error(struct sess *sp)
        char date[40];
 
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+       AZ(sp->bereq);
 
        /* We always close when we take this path */
        sp->doclose = "error";
@@ -663,6 +666,7 @@ cnt_miss(struct sess *sp)
                sp->step = STP_FETCH;
                return (0);
        case VCL_RET_RESTART:
+               VBE_free_bereq(&sp->bereq);
                INCOMPL();
        default:
                WRONG("Illegal action in vcl_miss{}");
@@ -713,6 +717,7 @@ cnt_pass(struct sess *sp)
 
        VCL_pass_method(sp);
        if (sp->handling == VCL_RET_ERROR) {
+               VBE_free_bereq(&sp->bereq);
                sp->step = STP_ERROR;
                return (0);
        }
@@ -769,6 +774,7 @@ cnt_pipe(struct sess *sp)
        assert(sp->handling == VCL_RET_PIPE);
 
        PipeSession(sp);
+       AZ(sp->bereq);
        AZ(sp->wrk->wfd);
        sp->step = STP_DONE;
        return (0);
index ec6a9e6a096dd6e737e9ff3b3559b34f8b1eccc9..cc7566ebac6a4eb34b9069f7b3d3182136edf484 100644 (file)
@@ -324,6 +324,7 @@ Fetch(struct sess *sp)
        CHECK_OBJ_NOTNULL(sp->bereq, BEREQ_MAGIC);
        AN(sp->director);
        AN(sp->obj->busy);
+       AN(sp->bereq);
        w = sp->wrk;
        bereq = sp->bereq;
        hp = bereq->http;
index 19d29cd2499fde41b7bbd72c691fcbef8e21992b..558daa0079d7e69e67c9d18f8a7656a11bf4fdf3 100644 (file)
@@ -634,6 +634,7 @@ http_FilterHeader(struct sess *sp, unsigned how)
        struct bereq *bereq;
        struct http *hp;
 
+       AZ(sp->bereq);
        bereq = VBE_new_bereq();
        AN(bereq);
        hp = bereq->http;
index 4ae3f83bef37c29ebdb4f02adb9986fc9df50391..eb725a3c9f7d7be721b6556d208a3f5038aae337 100644 (file)
@@ -90,14 +90,15 @@ PipeSession(struct sess *sp)
                sp->acct_req.bodybytes +=
                    WRW_Write(w, sp->htc->pipeline.b, Tlen(sp->htc->pipeline));
 
-       if (WRW_FlushRelease(w)) {
+       i = WRW_FlushRelease(w);
+       VBE_free_bereq(&bereq);
+
+       if (i) {
                vca_close_session(sp, "pipe");
                VBE_ClosedFd(sp);
                return;
        }
 
-       VBE_free_bereq(&bereq);
-
        sp->t_resp = TIM_real();
 
        memset(fds, 0, sizeof fds);