diff options
author | Volker Lendecke <vl@samba.org> | 2008-01-08 22:42:27 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-01-09 00:10:16 +0100 |
commit | 28a72ebd4541fb54f284da49081345e54130c75a (patch) | |
tree | a848ee681b5d2cc0f0bb385a4cb99618ca0623af /source/lib/talloc | |
parent | ef7c9a765bcdb1c774ff4f6d14053c4aa3815f31 (diff) | |
download | samba-28a72ebd4541fb54f284da49081345e54130c75a.tar.gz samba-28a72ebd4541fb54f284da49081345e54130c75a.tar.xz samba-28a72ebd4541fb54f284da49081345e54130c75a.zip |
Don't shrink a talloc area if we have less than 1k to gain
Diffstat (limited to 'source/lib/talloc')
-rw-r--r-- | source/lib/talloc/talloc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/lib/talloc/talloc.c b/source/lib/talloc/talloc.c index 4d72c0e871a..6dbe21bbf14 100644 --- a/source/lib/talloc/talloc.c +++ b/source/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; |