[vlc-commits] memstream: handle empty stream corner case

Rémi Denis-Courmont git at videolan.org
Sun Feb 26 13:57:40 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | 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;
 }



More information about the vlc-commits mailing list