[squid-users] Squid 3.5.16 and vary loop objects (bug ?)

Amos Jeffries squid3 at treenet.co.nz
Wed Apr 6 12:10:09 UTC 2016


On 6/04/2016 8:51 p.m., joe wrote:
> amos  one think i notice 
> === modified file 'src/MemObject.cc'
> --- src/MemObject.cc	2016-01-01 00:14:27 +0000
> +++ src/MemObject.cc	2016-04-01 06:15:31 +0000
> @@ -136,8 +136,6 @@
>      HTTPMSGUNLOCK(request);
>  
>      ctx_exit(ctx);              /* must exit before we free mem->url */
> -
> -    safe_free(vary_headers); /*??????? do we need to clear (vary_headers)
> if yes then you forget to insert vary_headers.clear(); */
> +    vary_headers.clear();      /* missing for reason on patch
> squid-3.5-14016.patch */
>  }
> 

That was intentional. The line of code above was in an objects
destructor. The safe_free() used to be needed to prevent the C-style bit
of memory being leaked.

The new code uses a C++ smart pointer called SBuf and it automatically
does that memory releasing in destructors without an explicit clear()
being needed.

(You can add a clear() if you want. All it will do is waste a few CPU
cycles.)

Amos



More information about the squid-users mailing list