summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ui/setting_item_device_list.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/ui/setting_item_device_list.c b/src/ui/setting_item_device_list.c
index 535f260..a125126 100644
--- a/src/ui/setting_item_device_list.c
+++ b/src/ui/setting_item_device_list.c
@@ -264,18 +264,22 @@ static void discovery_foreach_cb(conv_device_h device_h, int result, void *data)
case CONV_DISCOVERY_RESULT_SUCCESS :
conv_device_get_property_string(device_h, CONV_DEVICE_ID, &device_id);
+ conv_device_get_property_string(device_h, CONV_DEVICE_NAME, &device_name);
+ conv_device_get_property_string(device_h, CONV_DEVICE_TYPE, &device_type);
+
+ if (device_id == NULL | device_name == NULL | device_type == NULL) {
+ goto MEMORY_FREE;
+ }
+
int device_id_index;
for (device_id_index = 0; device_id_index < 5; device_id_index++) {
device_id[2+(device_id_index*3)] = '-';
}
- conv_device_get_property_string(device_h, CONV_DEVICE_NAME, &device_name);
- conv_device_get_property_string(device_h, CONV_DEVICE_TYPE, &device_type);
-
int index;
for (index = 0; index <= discovered_devices_index; index++) {
if (!strcmp(discovered_devices_info[index]->mac_address, device_id)) {
- return;
+ goto MEMORY_FREE;
}
}
@@ -290,6 +294,16 @@ static void discovery_foreach_cb(conv_device_h device_h, int result, void *data)
elm_genlist_item_append(discovered_list, device_item_builder, discovered_devices_info[index], discovered_device_group, ELM_GENLIST_ITEM_NONE, device_list_select_cb, discovered_devices_info[index]);
elm_genlist_item_fields_update(discovered_device_group, "elm.swallow.end", ELM_GENLIST_ITEM_FIELD_CONTENT);
+MEMORY_FREE:
+ if (device_id != NULL) {
+ free(device_id);
+ }
+ if (device_name != NULL) {
+ free(device_name);
+ }
+ if (device_type != NULL) {
+ free(device_type);
+ }
return;
case CONV_DISCOVERY_RESULT_FINISHED :