diff options
-rw-r--r-- | lib/util/charset/iconv.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/util/charset/iconv.c b/lib/util/charset/iconv.c index 24434ec809..74b931fa12 100644 --- a/lib/util/charset/iconv.c +++ b/lib/util/charset/iconv.c @@ -190,13 +190,19 @@ _PUBLIC_ size_t smb_iconv(smb_iconv_t cd, if (cd->pull(cd->cd_pull, inbuf, inbytesleft, &bufp1, &bufsize) == -1 - && errno != E2BIG) return -1; + && errno != E2BIG) { + talloc_free(cvtbuf); + return -1; + } bufsize = SMB_ICONV_BUFSIZE - bufsize; if (cd->push(cd->cd_push, &bufp2, &bufsize, - outbuf, outbytesleft) == -1) return -1; + outbuf, outbytesleft) == -1) { + talloc_free(cvtbuf); + return -1; + } } talloc_free(cvtbuf); } |