diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2006-02-11 18:11:09 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2006-02-11 18:11:09 +0000 |
commit | 6b6841f07e7f4afea7fc025214abedbc79d3aa03 (patch) | |
tree | a2421d06a01419423183043a71f2b07031beccfb /utils/utf8.c | |
parent | 6b3b19a95b3284752d08d54e276c307642102b1a (diff) | |
download | netsurf-6b6841f07e7f4afea7fc025214abedbc79d3aa03.tar.gz |
[project @ 2006-02-11 18:11:09 by jmb]
Clear cached conversion descriptor if iconv() fails
svn path=/import/netsurf/; revision=2071
Diffstat (limited to 'utils/utf8.c')
-rw-r--r-- | utils/utf8.c | 4 |
1 files changed, 4 insertions, 0 deletions
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 |