[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-1205-g3a4bf4b

Michael Adam obnox at samba.org
Wed Jan 9 00:37:15 GMT 2008


The branch, v3-2-test has been updated
       via  3a4bf4b7c3081048f0d5491dae6610388c268c2f (commit)
       via  45b219642c529865a898625eeb0433c60b233867 (commit)
      from  bedc493874adaf783362ba7b821e2a6d985b96ea (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 3a4bf4b7c3081048f0d5491dae6610388c268c2f
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 9 01:35:43 2008 +0100

    Add a comment.
    
    Michael

commit 45b219642c529865a898625eeb0433c60b233867
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 9 01:34:21 2008 +0100

    Fix talloctort: move size check after referenced ptr check.
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source/lib/talloc/talloc.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/talloc/talloc.c b/source/lib/talloc/talloc.c
index 6dbe21b..3e976bc 100644
--- a/source/lib/talloc/talloc.c
+++ b/source/lib/talloc/talloc.c
@@ -787,16 +787,17 @@ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *n
 
 	tc = talloc_chunk_from_ptr(ptr);
 
-	if ((size < tc->size) && ((tc->size - size) < 1024)) {
-		tc->size = size;
-		return ptr;
-	}
-
 	/* don't allow realloc on referenced pointers */
 	if (unlikely(tc->refs)) {
 		return NULL;
 	}
 
+	/* don't shrink if we have less than 1k to gain */
+	if ((size < tc->size) && ((tc->size - size) < 1024)) {
+		tc->size = size;
+		return ptr;
+	}
+
 	/* by resetting magic we catch users of the old memory */
 	tc->flags |= TALLOC_FLAG_FREE;
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list