From 7915e6741dbe1cf3a8781cead3e68a7666de14f4 Mon Sep 17 00:00:00 2001
From: Vittorio Giovara <vittorio.giovara@gmail.com>
Date: Thu, 22 Jan 2015 20:13:44 +0000
Subject: [PATCH] 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(-)

diff --git a/libavformat/hlsproto.c b/libavformat/hlsproto.c
index 751fef2e4d9..0eba049797e 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;
-- 
GitLab