[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10010: Avoid a segfault when freeing a buffer with size 0. (in tor/trunk: . src/or)



Author: nickm
Date: 2007-04-23 18:20:45 -0400 (Mon, 23 Apr 2007)
New Revision: 10010

Modified:
   tor/trunk/
   tor/trunk/src/or/buffers.c
Log:
 r12782@Kushana:  nickm | 2007-04-23 18:20:19 -0400
 Avoid a segfault when freeing a buffer with size 0.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r12782] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/src/or/buffers.c
===================================================================
--- tor/trunk/src/or/buffers.c	2007-04-23 20:52:04 UTC (rev 10009)
+++ tor/trunk/src/or/buffers.c	2007-04-23 22:20:45 UTC (rev 10010)
@@ -469,7 +469,7 @@
   buf->magic = 0xDEADBEEF;
   if (buf->len == MIN_LAZY_SHRINK_SIZE) {
     add_buf_mem_to_freelist(buf);
-  } else {
+  } else if (buf->mem) {
     oldmem = RAW_MEM(buf->mem);
     tor_free(oldmem);
   }