History

libavfilter/dnn_backend_native: check mem allocation

check that frame allocations return non-null.

Chris Miceli committed 6 years ago

Commit ad95e5e1 parent 00772ef1 file · +16 −1Browse files

Unified · Split

libavfilter/dnn/dnn_backend_native.c+16−1
@@ -79,8 +79,23 @@ static DNNReturnType get_output_native(void *model, const char *input_name, int · 78 unmodified lines
79{79{
80 DNNReturnType ret;80 DNNReturnType ret;
81 NativeModel *native_model = (NativeModel *)model;81 NativeModel *native_model = (NativeModel *)model;
82 NativeContext *ctx = &native_model->ctx;
82 AVFrame *in_frame = av_frame_alloc();83 AVFrame *in_frame = av_frame_alloc();
83 AVFrame *out_frame = av_frame_alloc();84 AVFrame *out_frame = NULL;
85
86 if (!in_frame) {
87 av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for input frame\n");
88 return DNN_ERROR;
89 }
90
91 out_frame = av_frame_alloc();
92
93 if (!out_frame) {
94 av_log(ctx, AV_LOG_ERROR, "Could not allocate memory for output frame\n");
95 av_frame_free(&in_frame);
96 return DNN_ERROR;
97 }
98
84 in_frame->width = input_width;99 in_frame->width = input_width;
85 in_frame->height = input_height;100 in_frame->height = input_height;
86 101

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t