vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sun Feb 26 
14:56:20 2017 +0200| [3514a4cecd9897c179d89ff6544faaf12182c6fa] | committer: 
Rémi Denis-Courmont

memstream: handle empty stream corner case

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3514a4cecd9897c179d89ff6544faaf12182c6fa
---

 src/text/memstream.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/text/memstream.c b/src/text/memstream.c
index 8e96309..4af651f 100644
--- a/src/text/memstream.c
+++ b/src/text/memstream.c
@@ -105,7 +105,9 @@ int vlc_memstream_vprintf(struct vlc_memstream *ms, const 
char *fmt,
 int vlc_memstream_open(struct vlc_memstream *ms)
 {
     ms->error = 0;
-    ms->ptr = NULL;
+    ms->ptr = calloc(1, 1);
+    if (unlikely(ms->ptr == NULL))
+        ms->error = EOF;
     ms->length = 0;
     return 0;
 }

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to