]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/tta.c
apetag: do not leak memory if avio_read() fails
[ffmpeg] / libavformat / tta.c
index 6bf097975a616afaaa8754bb8364dc7573131fb9..d7d41172d68059a9e76d1c778777fb776cc069c6 100644 (file)
@@ -38,7 +38,7 @@ static int tta_probe(AVProbeData *p)
     return 0;
 }
 
-static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
+static int tta_read_header(AVFormatContext *s)
 {
     TTAContext *c = s->priv_data;
     AVStream *st;
@@ -142,9 +142,10 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     int index = av_index_search_timestamp(st, timestamp, flags);
     if (index < 0)
         return -1;
+    if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0)
+        return -1;
 
     c->currentframe = index;
-    avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
 
     return 0;
 }