From 0af2efcdc4cd669db2a2ee582674dc030c6371a9 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 28a72ebd4541fb54f284da49081345e54130c75a) --- source3/lib/talloc/talloc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3') 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; -- cgit