diff --git a/src/device.c b/src/device.c
index 87ea0ed..01c40a7 100644
--- a/src/device.c
+++ b/src/device.c
groups = g_key_file_get_groups(key_file, NULL);
for (handle = groups; *handle; handle++) {
+ gboolean uuid_ok;
+
str = g_key_file_get_string(key_file, *handle, "UUID", NULL);
if (!str)
continue;
- if (!g_str_equal(str, prim_uuid))
- continue;
-
+ uuid_ok = g_str_equal(str, prim_uuid);
g_free(str);
+ if (!uuid_ok)
+ continue;
+
str = g_key_file_get_string(key_file, *handle, "Value", NULL);
if (!str)
continue;
}
break;
default:
+ g_free(str);
+ g_free(prim);
continue;
}