mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-10 00:59:38 +00:00
lavfi/dnn/dnn_backend_native: fix memory leak in error path
fix memory leak in error path Reviewed-by: Guo, Yejun <yejun.guo@intel.com> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
This commit is contained in:
parent
f156f4ab23
commit
1b0a8e48f1
@ -185,6 +185,7 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename)
|
|||||||
if (dnn_size > file_size || conv_params->input_num <= 0 ||
|
if (dnn_size > file_size || conv_params->input_num <= 0 ||
|
||||||
conv_params->output_num <= 0 || conv_params->kernel_size <= 0){
|
conv_params->output_num <= 0 || conv_params->kernel_size <= 0){
|
||||||
avio_closep(&model_file_context);
|
avio_closep(&model_file_context);
|
||||||
|
av_freep(&conv_params);
|
||||||
ff_dnn_free_model_native(&model);
|
ff_dnn_free_model_native(&model);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -192,6 +193,9 @@ DNNModel *ff_dnn_load_model_native(const char *model_filename)
|
|||||||
conv_params->biases = av_malloc(conv_params->output_num * sizeof(float));
|
conv_params->biases = av_malloc(conv_params->output_num * sizeof(float));
|
||||||
if (!conv_params->kernel || !conv_params->biases){
|
if (!conv_params->kernel || !conv_params->biases){
|
||||||
avio_closep(&model_file_context);
|
avio_closep(&model_file_context);
|
||||||
|
av_freep(&conv_params->kernel);
|
||||||
|
av_freep(&conv_params->biases);
|
||||||
|
av_freep(&conv_params);
|
||||||
ff_dnn_free_model_native(&model);
|
ff_dnn_free_model_native(&model);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user