---
 libavformat/asfdec.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 7d28f18..7458e19 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1646,14 +1646,14 @@ static int asf_read_header(AVFormatContext *s)
             if (ret == AVERROR_EOF && asf->data_reached)
                 break;
             else
-                return ret;
+                goto failed;
 
         g = find_guid(guid);
         if (g) {
             asf->unknown_offset = asf->offset;
             asf->is_header = 1;
             if ((ret = g->read_object(s, g)) < 0)
-                return ret;
+                goto failed;
         } else {
             size = avio_rl64(pb);
             align_position(pb, asf->offset, size);
@@ -1664,7 +1664,8 @@ static int asf_read_header(AVFormatContext *s)
 
     if (!asf->data_reached) {
         av_log(s, AV_LOG_ERROR, "Data Object was not found.\n");
-        return AVERROR_INVALIDDATA;
+        ret = AVERROR_INVALIDDATA;
+        goto failed;
     }
     if (pb->seekable)
         avio_seek(pb, asf->first_packet_offset, SEEK_SET);
@@ -1689,6 +1690,10 @@ static int asf_read_header(AVFormatContext *s)
     }
 
     return 0;
+
+failed:
+    asf_read_close(s);
+    return ret;
 }
 
 AVInputFormat ff_asf_demuxer = {
-- 
2.0.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to