Fix a conditional check. (size - tc->size > 0) is always true if size and tc->size...
authorJeremy Allison <jra@samba.org>
Tue, 27 Aug 2013 19:59:04 +0000 (12:59 -0700)
committerStefan Metzmacher <metze@samba.org>
Tue, 10 Mar 2015 09:55:36 +0000 (10:55 +0100)
Replace with (size > tc->size).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit 0fbcfcc824e474874c15d7c0b2ea0df408448906)

lib/talloc/talloc.c

index 54f3c0a56d3a1a901c42724f94264042ac0dbdf5..2683ff074e9e5f51bd5df84886d3e374da6be179 100644 (file)
@@ -1507,7 +1507,7 @@ _PUBLIC_ void *_talloc_realloc(const void *context, void *ptr, size_t size, cons
                return NULL;
        }
 
-       if (tc->limit && (size - tc->size > 0)) {
+       if (tc->limit && (size > tc->size)) {
                if (!talloc_memlimit_check(tc->limit, (size - tc->size))) {
                        errno = ENOMEM;
                        return NULL;