From: Vincent Fu Date: Tue, 11 Jun 2024 17:48:41 +0000 (+0000) Subject: Reapply "smalloc: smalloc() already clears memory, scalloc() need not do it again" X-Git-Tag: fio-3.38~56 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=f956fed4d181d41a5b1c49bba9dce46d8197d428;p=fio.git Reapply "smalloc: smalloc() already clears memory, scalloc() need not do it again" This reverts commit eb7fe4550ff2a569d0d8c71de16a1ea1e1aaf0a5. It turns out that each buffer is in fact cleared in smalloc_pool() when it is called by smalloc(). So there is no need to clear the buffer a second time in scalloc. Signed-off-by: Vincent Fu --- diff --git a/smalloc.c b/smalloc.c index 134f3d77..23243054 100644 --- a/smalloc.c +++ b/smalloc.c @@ -566,13 +566,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)