summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-01-09 01:34:21 +0100
committerMichael Adam <obnox@samba.org>2008-01-09 01:34:21 +0100
commitebb21268df233933938e64e83ed315313aedd544 (patch)
tree4356c84517f1352aed8f985f904a31d7eae3ff26 /source3/lib
parent7febec3c58bebb20d7866ea98c43bb41f0c09db4 (diff)
downloadsamba-ebb21268df233933938e64e83ed315313aedd544.tar.gz
samba-ebb21268df233933938e64e83ed315313aedd544.tar.bz2
samba-ebb21268df233933938e64e83ed315313aedd544.zip
Fix talloctort: move size check after referenced ptr check.
Michael (This used to be commit 45b219642c529865a898625eeb0433c60b233867)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/talloc/talloc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c
index 6dbe21bbf1..476d765104 100644
--- a/source3/lib/talloc/talloc.c
+++ b/source3/lib/talloc/talloc.c
@@ -787,16 +787,16 @@ 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;
}
+ if ((size < tc->size) && ((tc->size - size) < 1024)) {
+ tc->size = size;
+ return ptr;
+ }
+
/* by resetting magic we catch users of the old memory */
tc->flags |= TALLOC_FLAG_FREE;