From: MyungJoo Ham Date: Mon, 1 Apr 2019 07:55:04 +0000 (+0900) Subject: [SVACE/414631] Check malloc return value X-Git-Tag: accepted/tizen/unified/20190402.071859~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a493c320958542875823f79e892e48815f930f8;p=platform%2Fupstream%2Fnnstreamer.git [SVACE/414631] Check malloc return value Do not proceed if malloc returns null: Warning Message Pointer 'data' returned from function 'malloc' at nnstreamer_customfilter_example_scaler_allocator.c:65 may be null, and it is dereferenced at nnstreamer_customfilter_example_scaler_allocator.c:68. Signed-off-by: MyungJoo Ham --- diff --git a/nnstreamer_example/custom_example_scaler/nnstreamer_customfilter_example_scaler_allocator.c b/nnstreamer_example/custom_example_scaler/nnstreamer_customfilter_example_scaler_allocator.c index 57962c0..caa2748 100644 --- a/nnstreamer_example/custom_example_scaler/nnstreamer_customfilter_example_scaler_allocator.c +++ b/nnstreamer_example/custom_example_scaler/nnstreamer_customfilter_example_scaler_allocator.c @@ -63,6 +63,7 @@ static void * pt_init (const GstTensorFilterProperties * prop) { pt_data *data = (pt_data *) malloc (sizeof (pt_data)); + assert (data); if (prop->custom_properties && strlen (prop->custom_properties) > 0) data->property = g_strdup (prop->custom_properties);