[vlc-commits] stream: fix corner-case memory leak

Rémi Denis-Courmont git at videolan.org
Mon Aug 24 21:13:16 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 24 22:13:05 2015 +0300| [351620441e2dda81f656d062df1169973bc7f7de] | committer: Rémi Denis-Courmont

stream: fix corner-case memory leak

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

 src/input/stream.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index d08a55c..436c8f4 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -379,9 +379,11 @@ ssize_t stream_Peek(stream_t *s, const uint8_t **restrict bufp, size_t len)
         if (unlikely(peek == NULL))
             return VLC_ENOMEM;
 
+        *bufp = peek->p_buffer;
+
         if (unlikely(len == 0))
         {
-            *bufp = peek->p_buffer;
+            priv->peek = peek;
             return 0;
         }
 
@@ -392,7 +394,6 @@ ssize_t stream_Peek(stream_t *s, const uint8_t **restrict bufp, size_t len)
             return ret;
         }
 
-        *bufp = peek->p_buffer;
         peek->i_buffer = ret;
         priv->peek = peek;
         return ret;



More information about the vlc-commits mailing list