aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2021-11-30 00:59:14 +0100
committerMarton Balint <cus@passwd.hu>2021-12-12 00:32:20 +0100
commit8a40cfa4dab461643f4f93f3340c897d708ea221 (patch)
treed3e854390a14998733a66c19f1a921105c848914
parent722d28db129b2e52d19c1a5051ea4ab0a9b84062 (diff)
downloadffmpeg-8a40cfa4dab461643f4f93f3340c897d708ea221.tar.gz
avformat/aviobuf: return stored AVIO context error on avio_close
Otherwise IO errors at avio_flush() before closing may be lost. Signed-off-by: Marton Balint <cus@passwd.hu>
-rw-r--r--libavformat/aviobuf.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 14688a2262..969c127b23 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1231,6 +1231,7 @@ int avio_close(AVIOContext *s)
{
FFIOContext *const ctx = ffiocontext(s);
URLContext *h;
+ int ret, error;
if (!s)
return 0;
@@ -1249,9 +1250,14 @@ int avio_close(AVIOContext *s)
ctx->bytes_read, ctx->seek_count);
av_opt_free(s);
+ error = s->error;
avio_context_free(&s);
- return ffurl_close(h);
+ ret = ffurl_close(h);
+ if (ret < 0)
+ return ret;
+
+ return error;
}
int avio_closep(AVIOContext **s)