X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=smalloc.c;h=8412e7518464d6dbe3e7f218e33e47e855e8e26f;hp=b460d6573bbc4e081a394a76808a18e5ee705ab7;hb=f6cbf8ac4f70c800bbbfc23c5dcf44ed619c0acc;hpb=85492cb89e2421ae71d92b1c88e75efda3ee1f1b diff --git a/smalloc.c b/smalloc.c index b460d657..8412e751 100644 --- a/smalloc.c +++ b/smalloc.c @@ -32,7 +32,9 @@ #define SMALLOC_POST_RED 0x5aa55aa5U unsigned int smalloc_pool_size = INITIAL_SIZE; +#ifdef SMALLOC_REDZONE static const int int_mask = sizeof(int) - 1; +#endif struct pool { struct fio_mutex *lock; /* protects this pool */ @@ -363,8 +365,12 @@ void sfree(void *ptr) global_read_unlock(); - assert(pool); - sfree_pool(pool, ptr); + if (pool) { + sfree_pool(pool, ptr); + return; + } + + log_err("smalloc: ptr %p not from smalloc pool\n", ptr); } static void *__smalloc_pool(struct pool *pool, size_t size) @@ -486,13 +492,7 @@ void *smalloc(size_t size) void *scalloc(size_t nmemb, size_t size) { - void *ret; - - ret = smalloc(nmemb * size); - if (ret) - memset(ret, 0, nmemb * size); - - return ret; + return smalloc(nmemb * size); } char *smalloc_strdup(const char *str)