hlsproto: Properly close avio buffer in case of error

Message ID 20150123145736.4BA6A5DDCD@aruru.libav.org
State New
Headers show

Commit Message

Janne Grunau Jan. 23, 2015, 2:57 p.m.
Module: libav
Branch: master
Commit: 7915e6741dbe1cf3a8781cead3e68a7666de14f4

Author:    Vittorio Giovara <vittorio.giovara@gmail.com>
Committer: Vittorio Giovara <vittorio.giovara@gmail.com>
Date:      Thu Jan 22 20:13:44 2015 +0000

hlsproto: Properly close avio buffer in case of error

Fix a memory leak.

CC: libav-stable@libav.org
Bug-Id: CID 717999

---

 libavformat/hlsproto.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c
index 751fef2..0eba049 100644
--- a/libavformat/hlsproto.c
+++ b/libavformat/hlsproto.c
@@ -121,8 +121,10 @@  static int parse_playlist(URLContext *h, const char *url)
         return ret;
 
     read_chomp_line(in, line, sizeof(line));
-    if (strcmp(line, "#EXTM3U"))
-        return AVERROR_INVALIDDATA;
+    if (strcmp(line, "#EXTM3U")) {
+        ret = AVERROR_INVALIDDATA;
+        goto fail;
+    }
 
     free_segment_list(s);
     s->finished = 0;