summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-03-18 22:05:58 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2021-03-18 22:06:47 +0100
commit591089f58795edcee62be407244175633ab029cf (patch)
tree7d3d7479f524f6ec956390752664b8069f1d4cc2 /src
parent064e793e62f4d4900516ae159876b05f091a2b15 (diff)
downloadlibseccomp-591089f58795edcee62be407244175633ab029cf.tar.gz
helper: let zmalloc use cmalloc
The calloc function from the stdlib already sets the memory to 0. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/helper.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/helper.c b/src/helper.c
index 1017d52..6f4b6c2 100644
--- a/src/helper.c
+++ b/src/helper.c
@@ -34,18 +34,11 @@
*/
void *zmalloc(size_t size)
{
- void *ptr;
-
/* NOTE: unlike malloc() zero size allocations always return NULL */
if (size == 0)
return NULL;
- ptr = malloc(size);
- if (!ptr)
- return NULL;
- memset(ptr, 0, size);
-
- return ptr;
+ return calloc(1, size);
}
/**