fix(libvideo2x): added missing checks around freeing memory

Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
k4yt3x 2024-11-13 00:00:00 +00:00
parent 561671c4cb
commit 980b44bc05
No known key found for this signature in database

View File

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