From e1bb7859dc9ca1e15c200760fa1d647962fc69b2 Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Wed, 25 Jan 2006 18:38:26 +1000
Subject: [PATCH] Slight improvement in dmalloc handling of blocks where leaks
 are accepted.

Rev: src/block_alloc.h:1.80
---
 src/block_alloc.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/block_alloc.h b/src/block_alloc.h
index a698c6dad6..f4223dc3a8 100644
--- a/src/block_alloc.h
+++ b/src/block_alloc.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: block_alloc.h,v 1.79 2006/01/24 12:00:49 mast Exp $
+|| $Id: block_alloc.h,v 1.80 2006/01/25 08:38:26 mast Exp $
 */
 
 #undef PRE_INIT_BLOCK
@@ -238,14 +238,14 @@ static void PIKE_CONCAT3(dmalloc_free_,DATA,_block) (			\
   int dont_free = 0;							\
   size_t i;								\
   for (i = 0; i < (BSIZE); i++) {					\
-    if (dmalloc_check_allocated (blk->x + i, 1)) {			\
+    if (!dmalloc_check_allocated (blk->x + i, 0))			\
+      dmalloc_unregister (blk->x + i, 1);				\
+    else if (dmalloc_check_allocated (blk->x + i, 1)) {			\
       PIKE_CONCAT3(dmalloc_,DATA,_not_freed) (blk->x + i, msg);		\
-      dont_free = 1;							\
       DMALLOC_DESCRIBE_BLOCK ((blk->x + i));				\
       debug_malloc_dump_references (blk->x + i, 0, 2, 0);		\
+      dont_free = 1;							\
     }									\
-    else								\
-      dmalloc_unregister(blk->x + i, 1);				\
   }									\
   if (dont_free) {							\
     /* If a block still is in use we conciously leak this */		\
-- 
GitLab