From: Rosen Penev Date: Fri, 2 Feb 2018 06:52:12 +0000 (-0800) Subject: libubox: Plug a small memory leak. X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3aad2948ebceef7865a5cf749522bed9e332de05;p=oweals%2Flibubox.git libubox: Plug a small memory leak. va_end was not called if calloc fails. Signed-off-by: Rosen Penev --- diff --git a/utils.c b/utils.c index 765dd8b..c22250d 100644 --- a/utils.c +++ b/utils.c @@ -47,8 +47,11 @@ void *__calloc_a(size_t len, ...) va_end(ap1); ptr = calloc(1, alloc_len); - if (!ptr) + if (!ptr) { + va_end(ap); return NULL; + } + alloc_len = 0; foreach_arg(ap, cur_addr, cur_len, &ret, len) { *cur_addr = &ptr[alloc_len];