diff options
author | Rosen Penev <rosenp@gmail.com> | 2018-02-02 09:52:12 +0300 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2018-02-11 18:39:35 +0300 |
commit | 3aad2948ebceef7865a5cf749522bed9e332de05 (patch) | |
tree | ef5b67b190d13654a37e13f545a64ba5063f1414 /utils.c | |
parent | bb0c830b2a259b7c5ffa7c309ce9d3004f3c41a1 (diff) |
libubox: Plug a small memory leak.
va_end was not called if calloc fails.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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]; |