* src/iri.c (do_conversion): Initialize memory from realloc()

This commit is contained in:
Tim Rühsen 2024-05-05 18:10:10 +02:00
parent bb0aa299e9
commit 42c83d8972

View File

@ -191,7 +191,13 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz
tooshort++;
done = len;
len = done + inlen * 2;
s = xrealloc (s, len + 1);
char *s_new = xrealloc (s, len + 1);
if (s_new != s)
{
/* Help valgrind by initializing additional memory. */
s = s_new;
memset(s + done, 0, inlen * 2 + 1);
}
*out = s + done - outlen;
outlen += inlen * 2;
}