From b7a08cc19609c62a31b887f989f7133615cd2d35 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalenko Date: Tue, 15 Aug 2017 11:28:31 +0300 Subject: [PATCH] Fix unhandled malloc errors Change-Id: Iffc98eb6c5e335b5a55eed22013a848891848d69 Signed-off-by: Dmitry Kovalenko --- probe_event/gesture.c | 4 ++++ probe_thread/libdathread.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/probe_event/gesture.c b/probe_event/gesture.c index 8fff1aa..e8adfeb 100755 --- a/probe_event/gesture.c +++ b/probe_event/gesture.c @@ -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; diff --git a/probe_thread/libdathread.c b/probe_thread/libdathread.c index a7a667f..6cd4c3d 100644 --- a/probe_thread/libdathread.c +++ b/probe_thread/libdathread.c @@ -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; -- 2.7.4