From 709b7fcef47ee65cfb96c894df791a5c50be668a Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Mon, 23 Dec 2002 19:50:36 +0000 Subject: [PATCH] fix uninitialized var --- src/share/utf8/iconvert.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/share/utf8/iconvert.c b/src/share/utf8/iconvert.c index cb6ea5a3..a23168f6 100644 --- a/src/share/utf8/iconvert.c +++ b/src/share/utf8/iconvert.c @@ -56,7 +56,7 @@ int iconvert(const char *fromcode, const char *tocode, iconv_t cd1, cd2; char *ib; char *ob; - char *utfbuf, *outbuf, *newbuf; + char *utfbuf = 0, *outbuf, *newbuf; size_t utflen, outlen, ibl, obl, k; char tbuf[2048]; @@ -237,7 +237,8 @@ int iconvert(const char *fromcode, const char *tocode, return ret; fail: - free(utfbuf); + if(0 != utfbuf) + free(utfbuf); iconv_close(cd1); if (cd2 != (iconv_t)(-1)) iconv_close(cd2);