diff -urN lib/iconv_hook.c lib.20040430/iconv_hook.c --- lib/iconv_hook.c 2002-06-08 18:19:01.000000000 +0900 +++ lib.20040430/iconv_hook.c 2004-04-30 21:40:14.000000000 +0900 @@ -32,8 +32,9 @@ } int -iconv_hook_close(iconv_t cd) { - free((iconv_hook_t *)cd); +iconv_hook_close(iconv_hook_t *cd) { + (*(cd->cm->iconv_close))(cd->cd); + free(cd); return 0; } diff -urN lib/iconv_hook_eucjp.c lib.20040430/iconv_hook_eucjp.c --- lib/iconv_hook_eucjp.c 2002-06-10 22:57:52.000000000 +0900 +++ lib.20040430/iconv_hook_eucjp.c 2004-04-30 21:40:14.000000000 +0900 @@ -111,6 +111,7 @@ if (cl < 0xA0 || cl > 0xDF) { *srcbuf=(char *)(src-2); errno=EILSEQ; + free(tmpbuf); return -1; } *tmp++ = cl; @@ -118,6 +119,7 @@ /* We don't support JIS X 0212 */ *srcbuf=(char *)(src-2); errno=EILSEQ; + free(tmpbuf); return -1; } } diff -urN lib/iconv_hook_ja_auto.c lib.20040430/iconv_hook_ja_auto.c --- lib/iconv_hook_ja_auto.c 2002-06-08 18:32:41.000000000 +0900 +++ lib.20040430/iconv_hook_ja_auto.c 2004-04-30 21:40:14.000000000 +0900 @@ -37,6 +37,9 @@ cd->ienc = strdup(ienc); if (cd->oenc == NULL || cd->ienc == NULL){ + if (cd->oenc == NULL) free (cd->oenc); + if (cd->ienc == NULL) free (cd->ienc); + free(cd); return (iconv_t)(-1); } else { return (iconv_t)cd;