summaryrefslogtreecommitdiff
path: root/source4/lib/talloc
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-01-08 22:42:27 +0100
committerMichael Adam <obnox@samba.org>2008-02-11 15:07:46 +0100
commit44cb6a81f26aed44a5bdc383ad59c5fbd2789262 (patch)
treed75bd367fd12c2ed53d148041c4c8522023c47bc /source4/lib/talloc
parentb4c81c0c18d2354513600668d7980b0c7cdd94b8 (diff)
downloadsamba-44cb6a81f26aed44a5bdc383ad59c5fbd2789262.tar.gz
samba-44cb6a81f26aed44a5bdc383ad59c5fbd2789262.tar.bz2
samba-44cb6a81f26aed44a5bdc383ad59c5fbd2789262.zip
Don't shrink a talloc area if we have less than 1k to gain
(This used to be commit 0c829e6ee6f43299cc5889c2af3d0402256da0d0)
Diffstat (limited to 'source4/lib/talloc')
-rw-r--r--source4/lib/talloc/talloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c
index f9aefcd6de..7aad42ce8c 100644
--- a/source4/lib/talloc/talloc.c
+++ b/source4/lib/talloc/talloc.c
@@ -787,6 +787,11 @@ 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;