1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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

View File

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