The g_regex_match function creates match_info even if it
returns FALSE. So we should always call g_match_info_free.
A better solution is using g_autoptr for match_info variable.
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Michael Roth <[email protected]>
continue;
}
for (j = 0; hw_ids[j] != NULL; j++) {
- GMatchInfo *match_info;
+ g_autoptr(GMatchInfo) match_info;
GuestDeviceIdPCI *id;
if (!g_regex_match(device_pci_re, hw_ids[j], 0, &match_info)) {
continue;
id->vendor_id = g_ascii_strtoull(vendor_id, NULL, 16);
id->device_id = g_ascii_strtoull(device_id, NULL, 16);
- g_match_info_free(match_info);
break;
}
if (skip) {