Add checking memory allocation 71/224171/1 accepted/tizen/unified/20200210.131847 submit/tizen/20200207.062602
authorSemun Lee <semun.lee@samsung.com>
Fri, 7 Feb 2020 01:34:26 +0000 (10:34 +0900)
committerSemun Lee <semun.lee@samsung.com>
Fri, 7 Feb 2020 01:34:26 +0000 (10:34 +0900)
Issue was reported by a static analyzer.

Change-Id: Ib09b4826098bceb79c8d9036767e9ae685ea31a0
Signed-off-by: Semun Lee <semun.lee@samsung.com>
hf-agent/bluetooth-hf-agent.c

index 671432c..ed9799b 100644 (file)
@@ -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;