} else {
/* Insert data in the queue */
data = g_malloc0(sizeof(bt_sending_data_t));
+ if (data == NULL)
+ return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
+
data->file_path = g_new0(char *, file_count + 1);
data->address = g_strdup(address);
data->file_count = file_count;