summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-01-08 22:42:27 +0100
committerVolker Lendecke <vl@samba.org>2008-01-09 00:10:16 +0100
commit0af2efcdc4cd669db2a2ee582674dc030c6371a9 (patch)
tree927c6605e0f55874dadbb144a29bfbeb69bf2225
parente09316ed789accc77b1812e8da4f9aa20330e2ea (diff)
downloadsamba-0af2efcdc4cd669db2a2ee582674dc030c6371a9.tar.gz
samba-0af2efcdc4cd669db2a2ee582674dc030c6371a9.tar.bz2
samba-0af2efcdc4cd669db2a2ee582674dc030c6371a9.zip
Don't shrink a talloc area if we have less than 1k to gain
(This used to be commit 28a72ebd4541fb54f284da49081345e54130c75a)
-rw-r--r--source3/lib/talloc/talloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c
index 4d72c0e871..6dbe21bbf1 100644
--- a/source3/lib/talloc/talloc.c
+++ b/source3/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;