diff --git a/lib/libc/iconv/citrus_prop.c b/lib/libc/iconv/citrus_prop.c index 28318de05a35..642e4230986a 100644 --- a/lib/libc/iconv/citrus_prop.c +++ b/lib/libc/iconv/citrus_prop.c @@ -293,8 +293,10 @@ _citrus_prop_read_str(struct _memstream * __restrict ms, } _memstream_ungetc(ms, ch); errnum = _citrus_prop_read_character_common(ms, &ch); - if (errnum != 0) + if (errnum != 0) { + free(s); return (errnum); + } s[n] = ch; ++n, --m; }