From: Anchit Narang Date: Tue, 23 Jun 2015 04:59:43 +0000 (+0530) Subject: Fixed NULL pointer deference in bt-service/bt-service-obex-agent.c X-Git-Tag: accepted/tizen/mobile/20150708.015030~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd6502c1dd52e2bc27b450b83e010c14dfbfb669;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git Fixed NULL pointer deference in bt-service/bt-service-obex-agent.c Added NULL check after malloc to prevent bt-service crash if enough memory cannot be allocated Change-Id: Ia59ea7512107ceb4886b60183a7228bd7524520b --- diff --git a/bt-service/bt-service-obex-agent.c b/bt-service/bt-service-obex-agent.c index 6a988b3..174373e 100644 --- a/bt-service/bt-service-obex-agent.c +++ b/bt-service/bt-service-obex-agent.c @@ -389,6 +389,10 @@ void _bt_obex_agent_new(char *path) } } info = (bt_obex_agent_info *)malloc (sizeof(bt_obex_agent_info)); + if (info == NULL) { + BT_ERR("Failed to allocate memory"); + return; + } memset(info, 0, sizeof(bt_obex_agent_info)); info->path = g_strdup(path); obex_agent_list = g_slist_append(obex_agent_list, info);