From 5e641014ea1391c6353dfbf8d477c1153f27ad90 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalenko Date: Tue, 15 Aug 2017 11:38:29 +0300 Subject: [PATCH] Fix unhandled malloc errors Change-Id: Ifc62e7746b0646d60537a76ba86a34df35a14aac 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 f941c84..fdb4ddd 100755 --- a/probe_event/gesture.c +++ b/probe_event/gesture.c @@ -237,6 +237,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 62ac59f..c8c8b8e 100644 --- a/probe_thread/libdathread.c +++ b/probe_thread/libdathread.c @@ -81,6 +81,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