summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index ec21fc7d38..716c42eda9 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -143,6 +143,11 @@ AVIOContext *avio_alloc_context(
return s;
}
+void avio_context_free(AVIOContext **ps)
+{
+ av_freep(ps);
+}
+
static void writeout(AVIOContext *s, const uint8_t *data, int len)
{
if (!s->error) {
@@ -1123,7 +1128,9 @@ int avio_close(AVIOContext *s)
else
av_log(s, AV_LOG_DEBUG, "Statistics: %"PRId64" bytes read, %d seeks\n", s->bytes_read, s->seek_count);
av_opt_free(s);
- av_free(s);
+
+ avio_context_free(&s);
+
return ffurl_close(h);
}
@@ -1356,7 +1363,9 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
*pbuffer = d->buffer;
size = d->size;
av_free(d);
- av_free(s);
+
+ avio_context_free(&s);
+
return size - padding;
}
@@ -1399,6 +1408,8 @@ int ffio_close_null_buf(AVIOContext *s)
size = d->size;
av_free(d);
- av_free(s);
+
+ avio_context_free(&s);
+
return size;
}