libubox: Plug a small memory leak.

va_end was not called if calloc fails.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2018-02-01 22:52:12 -08:00 committed by John Crispin
parent bb0c830b2a
commit 3aad2948eb

View file

@ -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];