avutil/frame: free the old side data buffer before replacing it

Fixes memleaks reported by ASAN/Valgrind.

Reported-by: Sean McGovern <gseanmcg@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
release/7.1
James Almer 7 months ago
parent 6d0c89980c
commit dd5f665b40
  1. 1
      libavutil/frame.c

@ -811,6 +811,7 @@ static AVFrameSideData *replace_side_data_from_buf(AVFrameSideData *dst,
return NULL;
av_dict_free(&dst->metadata);
av_buffer_unref(&dst->buf);
dst->buf = buf;
dst->data = buf->data;
dst->size = buf->size;

Loading…
Cancel
Save