[t:3825] #3825 Do not count free() operations when passed a NULL.

git-svn-id: file:///svn/toku/tokudb@33950 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Barry Perlman 2013-04-16 23:59:47 -04:00 committed by Yoni Fogel
parent cfebabfdfa
commit 44b5e6d620

View file

@ -77,13 +77,15 @@ toku_strdup(const char *s) {
void
toku_free(void *p) {
size_t used = p ? malloc_usable_size(p) : 0;
__sync_add_and_fetch(&status.free_count, 1L);
__sync_add_and_fetch(&status.freed, used);
if (t_free)
t_free(p);
else
os_free(p);
if (p) {
size_t used = malloc_usable_size(p);
__sync_add_and_fetch(&status.free_count, 1L);
__sync_add_and_fetch(&status.freed, used);
if (t_free)
t_free(p);
else
os_free(p);
}
}
void