summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-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;