Skip to content

Commit

Permalink
Free constraints when not needed anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
katajakasa committed May 14, 2024
1 parent e34f8f4 commit f551909
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/internal/kitdecoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,26 @@ static bool Kit_FindHardwareDecoder(
continue;
}
if((constraints = av_hwdevice_get_hwframe_constraints(*hw_device_ctx, config)) == NULL) {
goto fail;
goto fail_1;
}
if(constraints->max_height < h || constraints->min_height > h) {
goto fail;
goto fail_2;
}
if(constraints->max_width < w || constraints->min_width > w) {
goto fail;
goto fail_2;
}
if(!Kit_TestSWFormat(constraints)) {
goto fail;
goto fail_2;
}

*type = config->device_type;
*hw_fmt = config->pix_fmt;
av_hwframe_constraints_free(&constraints);
return true;

fail:
fail_2:
av_hwframe_constraints_free(&constraints);
fail_1:
av_buffer_unref(hw_device_ctx);
*hw_device_ctx = NULL;
}
Expand Down

0 comments on commit f551909

Please sign in to comment.