From: Ben Pfaff Date: Wed, 23 Mar 2011 04:20:04 +0000 (-0700) Subject: i18n: Only close valid iconv converters in i18n_done(). X-Git-Tag: v0.7.7~2 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=213a9dde780d4b31cdcf7dd14f5015633a89cec5 i18n: Only close valid iconv converters in i18n_done(). iconv_open() returns (iconv_t) -1 to indicate an error. We shouldn't pass this to iconv_Close(). Reported-by: Jeremy Lavergne . John Darrington suggested that this was probably the problem, and Jeremy confirmed it with valgrind. --- diff --git a/src/libpspp/i18n.c b/src/libpspp/i18n.c index 0e461db1..fbff1772 100644 --- a/src/libpspp/i18n.c +++ b/src/libpspp/i18n.c @@ -609,7 +609,8 @@ i18n_done (void) { free (cvtr->tocode); free (cvtr->fromcode); - iconv_close (cvtr->conv); + if (cvtr->conv != (iconv_t) -1) + iconv_close (cvtr->conv); free (cvtr); }