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>
This commit is contained in:
James Almer 2024-04-11 12:32:11 -03:00
parent 6d0c89980c
commit dd5f665b40
1 changed files with 1 additions and 0 deletions

View File

@ -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;