Fix unhandled malloc errors 03/145203/2 submit/tizen_3.0/20170822.071124
authorDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 15 Aug 2017 08:38:29 +0000 (11:38 +0300)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 21 Aug 2017 14:52:43 +0000 (17:52 +0300)
Change-Id: I35f09fd4aab988dbd174d079475a46ba44e27a10
Signed-off-by: Dmitry Kovalenko <d.kovalenko@samsung.com>
probe_event/gesture.c
probe_thread/libdathread.c

index 8fff1aa..e8adfeb 100755 (executable)
@@ -232,6 +232,10 @@ void PROBE_NAME(elm_gesture_layer_cb_set)(Evas_Object *obj, Elm_Gesture_Type idx
 
        /* TODO Free memory on cb remove */
        elm = malloc(sizeof(*elm));
+       if (!elm) {
+               PRINTERR("Can't allocate memory for elm");
+               return;
+       }
 
        elm->obj = obj;
        elm->idx = idx;
index a7a667f..6cd4c3d 100644 (file)
@@ -82,6 +82,11 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_create, pthread_t *, thread,
        {
                thread_routine_call *ptrc =
                        (thread_routine_call *)malloc(sizeof(thread_routine_call));
+               if (!ptrc) {
+                       PRINTERR("Can't allocate memory for ptrc");
+                       return EAGAIN;
+               }
+
                ptrc->thread_routine = start_routine;
                ptrc->argument = arg;