From 947b8011535bdd832779481b46ef29a62c8da50e Mon Sep 17 00:00:00 2001 From: Avril Date: Sun, 11 Jul 2021 21:49:04 +0100 Subject: [PATCH] Fix returning on error from vararg function `cmp_find_many()` not calling `va_end()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fortune for naka's current commit: Future blessing − 末吉 --- src/comp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/comp.c b/src/comp.c index 436e188..74f3185 100644 --- a/src/comp.c +++ b/src/comp.c @@ -25,14 +25,18 @@ int cmp_find_many(usize nhaystacks; const map_t *pIN needle, usize sizes[pOUT nh va_start(v_haystacks, nhaystacks); const map_t* pINOUT haystack; + register int rval=-1; for(usize i=0;iorigin) FATAL("haystack %lu was null or its origin was null", i); - if(!cmp_find(needle, haystack, size)) return (int)i; + if(!cmp_find(needle, haystack, size)) { + rval = (int)i; + break; + } } va_end(v_haystacks); - return -1; + return rval; }