diff options
author | Vincent Sanders <vince@kyllikki.org> | 2022-11-26 15:08:38 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2022-11-26 15:21:16 +0000 |
commit | 0c25ae5e8eb38b3b888a9bfdc0fcc6d53af17b04 (patch) | |
tree | a3e68eb7c6b243528c689bfc4aa0ba473131acd6 /utils | |
parent | 1d82ef411a65095f218c15441fb804715e59f0eb (diff) | |
download | netsurf-0c25ae5e8eb38b3b888a9bfdc0fcc6d53af17b04.tar.gz netsurf-0c25ae5e8eb38b3b888a9bfdc0fcc6d53af17b04.tar.bz2 |
remove the ambiguity around the reallocation in utf8_to_html()
Diffstat (limited to 'utils')
-rw-r--r-- | utils/utf8.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/utils/utf8.c b/utils/utf8.c index 7aa7d935b..84918cc65 100644 --- a/utils/utf8.c +++ b/utils/utf8.c @@ -365,11 +365,11 @@ utf8_convert_html_chunk(iconv_t cd, /* exported interface documented in utils/utf8.h */ nserror -utf8_to_html(const char *string, const char *encname, size_t len, char **result) +utf8_to_html(const char *string, const char *encname, size_t len, char **result_out) { iconv_t cd; const char *in; - char *out, *origout; + char *out, *origout, *result; size_t off, prev_off, inlen, outlen, origoutlen, esclen; nserror ret; char *pescape, escape[11]; @@ -452,11 +452,12 @@ utf8_to_html(const char *string, const char *encname, size_t len, char **result) outlen -= 4; /* Shrink-wrap */ - *result = realloc(origout, origoutlen - outlen); - if (*result == NULL) { + result = realloc(origout, origoutlen - outlen); + if (result == NULL) { free(origout); return NSERROR_NOMEM; } + *result_out = result; return NSERROR_OK; } |