Skip to content

Commit

Permalink
fix(libvideo2x): added missing checks around freeing memory
Browse files Browse the repository at this point in the history
Signed-off-by: k4yt3x <[email protected]>
  • Loading branch information
k4yt3x committed Nov 13, 2024
1 parent 561671c commit 980b44b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/libvideo2x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@ static int process_frames(

// Lambda function for cleaning up resources
auto cleanup = [&]() {
av_frame_free(&frame);
av_packet_free(&packet);
if (frame) {
av_frame_free(&frame);
frame = nullptr;
}
if (packet) {
av_packet_free(&packet);
packet = nullptr;
}
for (AVFrame *&flushed_frame : flushed_frames) {
if (flushed_frame) {
av_frame_free(&flushed_frame);
Expand Down

0 comments on commit 980b44b

Please sign in to comment.