diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index d39b0c12eb..30db4a66dc 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1098,7 +1098,6 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) *pbuffer = NULL; return 0; } - d = s->opaque; /* don't attempt to pad fixed-size packet buffers */ if (!s->max_packet_size) { @@ -1108,6 +1107,7 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) avio_flush(s); + d = s->opaque; *pbuffer = d->buffer; size = d->size; av_free(d);