Skip to content

Commit

Permalink
[ffmpeg plugin] Fix leak during failure
Browse files Browse the repository at this point in the history
When decoding "fails" in ffmpeg decoder, it is possible that NalMap is not
cleaned up properly causing a leak.
  • Loading branch information
roticv committed Aug 27, 2024
1 parent 543bf9c commit df460da
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libheif/plugins/decoder_ffmpeg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ static void ffmpeg_free_decoder(void* decoder_raw)
{
struct ffmpeg_decoder* decoder = (struct ffmpeg_decoder*) decoder_raw;

//decoder->NalMap not needed anymore
for (auto current = decoder->NalMap.begin(); current != decoder->NalMap.end(); ++current) {
delete current->second;
}
decoder->NalMap.clear();

delete decoder;
}

Expand Down

0 comments on commit df460da

Please sign in to comment.