[SVACE/414632] Check malloc return value
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 1 Apr 2019 07:57:40 +0000 (16:57 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 1 Apr 2019 10:46:52 +0000 (19:46 +0900)
Do not proceed if malloc returns null:
Warning Message
Pointer 'data' returned from function 'malloc' at nnscustom_framecounter.c:96 may be null, and it is dereferenced at nnscustom_framecounter.c:98.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
tests/nnstreamer_sink/nnscustom_framecounter.c

index 709ed40..eb14c1f 100644 (file)
@@ -94,6 +94,7 @@ static void *
 pt_init (const GstTensorFilterProperties * prop)
 {
   pt_data *data = (pt_data *) malloc (sizeof (pt_data));
+  assert (data);
   maxid = maxid + 1;
   data->id = maxid;
   data->counter = 0U;