From: Semun Lee Date: Fri, 7 Feb 2020 01:34:26 +0000 (+0900) Subject: Add checking memory allocation X-Git-Tag: accepted/tizen/unified/20200210.131847^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fbluetooth-agent.git;a=commitdiff_plain;h=3aebeaa19339548d1cd1a567afce5a08ee988d64 Add checking memory allocation Issue was reported by a static analyzer. Change-Id: Ib09b4826098bceb79c8d9036767e9ae685ea31a0 Signed-off-by: Semun Lee --- diff --git a/hf-agent/bluetooth-hf-agent.c b/hf-agent/bluetooth-hf-agent.c index 671432c..ed9799b 100644 --- a/hf-agent/bluetooth-hf-agent.c +++ b/hf-agent/bluetooth-hf-agent.c @@ -1041,6 +1041,11 @@ gboolean __bt_hf_agent_add_queue(GDBusMethodInvocation *context, char *at, pending_flag ? "TRUE" : "FALSE"); bt_hf_agent_send_at_info *cmd = g_new0(bt_hf_agent_send_at_info, 1); + if (!cmd) { + ERR("failed to allocate cmd"); + return FALSE; + } + cmd->id = ++g_id; memcpy(cmd->at_cmd, at, count); cmd->count = count;