From: Hilko Bengen Date: Mon, 12 Jul 2010 13:50:31 +0000 (+0100) Subject: Call iconv_close along error path out of function. X-Git-Tag: 1.2.3~5 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=374659033e8eeea5b25246a9ef80bee3ebc2cde9;p=hivex.git Call iconv_close along error path out of function. --- diff --git a/lib/hivex.c b/lib/hivex.c index c65f6de..2b22924 100644 --- a/lib/hivex.c +++ b/lib/hivex.c @@ -1275,12 +1275,16 @@ windows_utf16_to_utf8 (/* const */ char *input, size_t len) size_t r = iconv (ic, &inp, &inlen, &outp, &outlen); if (r == (size_t) -1) { if (errno == E2BIG) { + int err = errno; size_t prev = outalloc; /* Try again with a larger output buffer. */ free (out); outalloc *= 2; - if (outalloc < prev) + if (outalloc < prev) { + iconv_close (ic); + errno = err; return NULL; + } goto again; } else {