From 44cb6a81f26aed44a5bdc383ad59c5fbd2789262 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 8 Jan 2008 22:42:27 +0100 Subject: Don't shrink a talloc area if we have less than 1k to gain (This used to be commit 0c829e6ee6f43299cc5889c2af3d0402256da0d0) --- source4/lib/talloc/talloc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4') 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; -- cgit