From 17f6585c902608df46dde19f6a5d799ef7bc8e02 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalenko Date: Tue, 15 Aug 2017 11:15:02 +0300 Subject: Fix unhandled malloc error Change-Id: Ie9bc610addf071bf9202e38e24ca17c9cf813dca Signed-off-by: Dmitry Kovalenko --- daemon/da_inst.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon/da_inst.c b/daemon/da_inst.c index 119f412..cec0649 100644 --- a/daemon/da_inst.c +++ b/daemon/da_inst.c @@ -743,6 +743,10 @@ static void generate_type_and_info(struct user_space_inst_t *us_inst) free(lib_maps_message); lib_maps_message = malloc(total_len); + if (!lib_maps_message) { + LOGE("Can't allocate memory for lib_maps_message\n"); + goto unlock_lib_maps_msg; + } lib_maps_message->type = APP_MSG_TYPE_AND_INFO; lib_maps_message->length = total_len; @@ -769,6 +773,7 @@ static void generate_type_and_info(struct user_space_inst_t *us_inst) LOGI("total_len = %u\n", total_len); print_buf((char *)lib_maps_message, total_len, "lib_maps_message"); +unlock_lib_maps_msg: unlock_lib_maps_message(); } -- cgit v1.2.3