From 50fd596efcd0f556104a05ba2c6a35400ae989eb Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 28 May 2021 19:38:34 +0900 Subject: [PATCH] path-util: add missing varargs cleanup Fixes CID#1453293. --- src/basic/path-util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 2742a27672..82f3709042 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -577,12 +577,13 @@ char* path_extend_internal(char **x, ...) { continue; add = 1 + strlen(p); - if (sz > SIZE_MAX - add) /* overflow check */ + if (sz > SIZE_MAX - add) { /* overflow check */ + va_end(ap); return NULL; + } sz += add; } - va_end(ap); nx = realloc(x ? *x : NULL, GREEDY_ALLOC_ROUND_UP(sz+1));