aboutsummaryrefslogtreecommitdiff
path: root/libavfilter/dnn/dnn_backend_native_layer_depth2space.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavfilter/dnn/dnn_backend_native_layer_depth2space.c')
-rw-r--r--libavfilter/dnn/dnn_backend_native_layer_depth2space.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavfilter/dnn/dnn_backend_native_layer_depth2space.c b/libavfilter/dnn/dnn_backend_native_layer_depth2space.c
index 5a61025f7a..4107ee6cae 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_depth2space.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_depth2space.c
@@ -50,7 +50,7 @@ int dnn_load_layer_depth2space(Layer *layer, AVIOContext *model_file_context, in
}
int dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_operand_indexes,
- int32_t output_operand_index, const void *parameters)
+ int32_t output_operand_index, const void *parameters, NativeContext *ctx)
{
float *output;
const DepthToSpaceParams *params = (const DepthToSpaceParams *)parameters;
@@ -75,11 +75,15 @@ int dnn_execute_layer_depth2space(DnnOperand *operands, const int32_t *input_ope
output_operand->dims[3] = new_channels;
output_operand->data_type = operands[input_operand_index].data_type;
output_operand->length = calculate_operand_data_length(output_operand);
- if (output_operand->length <= 0)
+ if (output_operand->length <= 0) {
+ av_log(ctx, AV_LOG_ERROR, "The output data length overflow\n");
return DNN_ERROR;
+ }
output_operand->data = av_realloc(output_operand->data, output_operand->length);
- if (!output_operand->data)
+ if (!output_operand->data) {
+ av_log(ctx, AV_LOG_ERROR, "Failed to reallocate memory for output\n");
return DNN_ERROR;
+ }
output = output_operand->data;
for (y = 0; y < height; ++y){