--------------------- PatchSet 1959 Date: 2005/10/17 23:35:39 Author: rousskov Branch: squid3-icap Tag: (none) Log: - If a dirty non-stolen buffer is deleted, clean it instead of asserting that it is clean. Not cleaning or asserting makes it is very difficult to use MemBufs around exception-throwing code: When the exception is thrown and the stack is unwinding, the buffer either leaks memory or asserts. This should be a relatively safe change because MemBufs are not copied. The only likely problem is that we might not notice when some lazy code is not explicitly cleaning their temporary buffers. On the other hand, if this change stays, then we should call init() from the constructor and enjoy an OO-friendly MemBuf that does not require explicit init() and clean() methods! Members: src/MemBuf.cci:1.2.20.5->1.2.20.6 Index: squid3/src/MemBuf.cci =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/MemBuf.cci,v retrieving revision 1.2.20.5 retrieving revision 1.2.20.6 diff -u -r1.2.20.5 -r1.2.20.6 --- squid3/src/MemBuf.cci 23 Sep 2005 23:08:49 -0000 1.2.20.5 +++ squid3/src/MemBuf.cci 17 Oct 2005 23:35:39 -0000 1.2.20.6 @@ -1,6 +1,6 @@ /* - * $Id: MemBuf.cci,v 1.2.20.5 2005/09/23 23:08:49 dwsquid Exp $ + * $Id: MemBuf.cci,v 1.2.20.6 2005/10/17 23:35:39 rousskov Exp $ * * DEBUG: section 59 auto-growing Memory Buffer with printf * AUTHOR: Robert Collins @@ -38,7 +38,7 @@ MemBuf::~MemBuf() { - if (!stolen) - assert(NULL == buf); + if (!stolen && buf) + clean(); valid = 0; }