[master] c6a24d7 Fix memory leak in time to first byte handling

Tollef Fog Heen tfheen at varnish-cache.org
Wed Apr 13 13:08:50 CEST 2011


commit c6a24d71bb1a0354bd94f537507852b1cbe76bac
Author: Tollef Fog Heen <tfheen at varnish-software.com>
Date:   Wed Apr 13 13:06:40 2011 +0200

    Fix memory leak in time to first byte handling
    
    Fixes #898
    
    Thanks to omes and vorpal for diagnosis and patch

diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 8367ba4..9a95ab5 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -219,6 +219,7 @@ clean_logline(struct logline *lp)
 	freez(lp->df_m);
 	freez(lp->df_s);
 	freez(lp->df_u);
+	freez(lp->df_ttfb);
 #undef freez
 	memset(lp, 0, sizeof *lp);
 }
@@ -471,7 +472,7 @@ collect_client(struct logline *lp, enum vsl_tag tag, unsigned spec,
 		char ttfb[64];
 		if (!lp->active)
 			break;
-		if (sscanf(ptr, "%*u %*u.%*u %ld.%*u %*u.%*u %s", &l, ttfb) != 2) {
+		if (lp->df_ttfb != NULL || sscanf(ptr, "%*u %*u.%*u %ld.%*u %*u.%*u %s", &l, ttfb) != 2) {
 			clean_logline(lp);
 			break;
 		}



More information about the varnish-commit mailing list