Skip to content

Commit

Permalink
avutil/frame: free the old side data buffer before replacing it
Browse files Browse the repository at this point in the history
Fixes memleaks reported by ASAN/Valgrind.

Reported-by: Sean McGovern <[email protected]>
Signed-off-by: James Almer <[email protected]>
  • Loading branch information
jamrial committed Apr 11, 2024
1 parent 6d0c899 commit dd5f665
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libavutil/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dd5f665

Please sign in to comment.