summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2022-11-26 15:08:38 +0000
committerVincent Sanders <vince@kyllikki.org>2022-11-26 15:08:38 +0000
commit5b6344182634b08e1586682c1c76a0a88d49a24c (patch)
tree5e5f33388ca1a34448c37fbc6b979250110dbf35
parent109527d02fd3aeef09bf82a450ecb0e3ed86f8ea (diff)
downloadnetsurf-5b6344182634b08e1586682c1c76a0a88d49a24c.tar.gz
netsurf-5b6344182634b08e1586682c1c76a0a88d49a24c.tar.bz2
remove the ambiguity around the reallocation in utf8_to_html()
-rw-r--r--utils/utf8.c9
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;
}