[vlc-devel] [PATCH 2/2] strings: vlc_xml_encode: fix error-path
Filip Roséen
filip at atch.se
Fri Feb 24 21:32:57 CET 2017
The resource should only be freed if vlc_memstream_close was
successful, as only then do we have ownership of what stream.ptr
refers to.
---
src/text/strings.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/text/strings.c b/src/text/strings.c
index 6daad07c68..7adfbcd95e 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -297,7 +297,7 @@ char *vlc_xml_encode (const char *str)
{
if (unlikely(n == (size_t)-1))
{
- if (vlc_memstream_close(&stream))
+ if (vlc_memstream_close(&stream) == 0)
free(stream.ptr);
errno = EILSEQ;
return NULL;
--
2.11.1
More information about the vlc-devel
mailing list