git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0c829e6
)
Fix talloctort: move size check after referenced ptr check.
author
Michael Adam
<obnox@samba.org>
Wed, 9 Jan 2008 00:34:21 +0000
(
01:34
+0100)
committer
Michael Adam
<obnox@samba.org>
Mon, 11 Feb 2008 14:07:46 +0000
(15:07 +0100)
Michael
source/lib/talloc/talloc.c
patch
|
blob
|
history
diff --git
a/source/lib/talloc/talloc.c
b/source/lib/talloc/talloc.c
index 7aad42ce8cc571d8865002fb5b5f8fe9bbdd6770..9e141ab5fdeb975794d352deece5aa27cacf2661 100644
(file)
--- a/
source/lib/talloc/talloc.c
+++ b/
source/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;