From 6b6841f07e7f4afea7fc025214abedbc79d3aa03 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 11 Feb 2006 18:11:09 +0000 Subject: [project @ 2006-02-11 18:11:09 by jmb] Clear cached conversion descriptor if iconv() fails svn path=/import/netsurf/; revision=2071 --- utils/utf8.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'utils/utf8.c') diff --git a/utils/utf8.c b/utils/utf8.c index a68d3c807..5425505ef 100644 --- a/utils/utf8.c +++ b/utils/utf8.c @@ -320,6 +320,10 @@ utf8_convert_ret utf8_convert(const char *string, size_t len, /* perform conversion */ if (iconv(cd, &in, &slen, &out, &rlen) == (size_t)-1) { free(temp); + /* clear the cached conversion descriptor as it's invalid */ + last_cd.from[0] = '\0'; + last_cd.to[0] = '\0'; + last_cd.cd = 0; /** \todo handle the various cases properly * There are 3 possible error cases: * a) Insufficiently large output buffer -- cgit v1.2.3