From: Ben Pfaff <blp@cs.stanford.edu> Date: Wed, 23 Mar 2011 04:20:04 +0000 (-0700) Subject: i18n: Only close valid iconv converters in i18n_done(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=213a9dde780d4b31cdcf7dd14f5015633a89cec5;p=pspp 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 <jeremy@lavergne.gotdns.org>. 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 0e461db160..fbff1772a1 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); }