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 | 0af2efcdc4cd669db2a2ee582674dc030c6371a9 (patch) | |
tree | 927c6605e0f55874dadbb144a29bfbeb69bf2225 | |
parent | e09316ed789accc77b1812e8da4f9aa20330e2ea (diff) | |
download | samba-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.c | 5 |
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; |