summaryrefslogtreecommitdiff
path: root/libavfilter/dnn/dnn_backend_native_layer_pad.c
diff options
context:
space:
mode:
authorTing Fu <ting.fu@intel.com>2020-08-25 11:47:50 +0800
committerGuo, Yejun <yejun.guo@intel.com>2020-08-25 13:03:46 +0800
commitc8ba0daf8dab2f5cbcdded37cd6383649933fbf3 (patch)
tree07fc4d82be5a16a925f5710ec370141e1163d778 /libavfilter/dnn/dnn_backend_native_layer_pad.c
parent230cf9d1854b171727d1b10c2a2fbe0df9d1d489 (diff)
dnn/native: add log error message
Signed-off-by: Ting Fu <ting.fu@intel.com>
Diffstat (limited to 'libavfilter/dnn/dnn_backend_native_layer_pad.c')
-rw-r--r--libavfilter/dnn/dnn_backend_native_layer_pad.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavfilter/dnn/dnn_backend_native_layer_pad.c b/libavfilter/dnn/dnn_backend_native_layer_pad.c
index 5452d22878..05892d43f4 100644
--- a/libavfilter/dnn/dnn_backend_native_layer_pad.c
+++ b/libavfilter/dnn/dnn_backend_native_layer_pad.c
@@ -76,7 +76,7 @@ static int after_get_buddy(int given, int border, LayerPadModeParam mode)
}
int dnn_execute_layer_pad(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)
{
int32_t before_paddings;
int32_t after_paddings;
@@ -111,11 +111,15 @@ int dnn_execute_layer_pad(DnnOperand *operands, const int32_t *input_operand_ind
output_operand->dims[3] = new_channel;
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;
// copy the original data