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:
parent
bb0c830b2a
commit
3aad2948eb
1 changed files with 4 additions and 1 deletions
5
utils.c
5
utils.c
|
@ -47,8 +47,11 @@ void *__calloc_a(size_t len, ...)
|
||||||
va_end(ap1);
|
va_end(ap1);
|
||||||
|
|
||||||
ptr = calloc(1, alloc_len);
|
ptr = calloc(1, alloc_len);
|
||||||
if (!ptr)
|
if (!ptr) {
|
||||||
|
va_end(ap);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
alloc_len = 0;
|
alloc_len = 0;
|
||||||
foreach_arg(ap, cur_addr, cur_len, &ret, len) {
|
foreach_arg(ap, cur_addr, cur_len, &ret, len) {
|
||||||
*cur_addr = &ptr[alloc_len];
|
*cur_addr = &ptr[alloc_len];
|
||||||
|
|
Loading…
Reference in a new issue