If pci_init_name_list_path() does not call pci_set_name_list_path() then
a->id_file_name variable is NULL and pci_load_name_list() would crash as it
tries to do fopen(NULL, ...).
If libpci was configured at compile time to use current executable path for
locating pci.ids file and it is not possible to determinate current
executable path then call pci_set_name_list_path() with just filename
without path (this would fallback to the current working directory).
len = GetModuleFileNameA(NULL, path, MAX_PATH+1);
sep = (len > 0) ? strrchr(path, '\\') : NULL;
if (len == 0 || len == MAX_PATH+1 || !sep || MAX_PATH-(size_t)(sep+1-path) < sizeof(PCI_IDS))
- free(path);
+ {
+ free(path);
+ pci_set_name_list_path(a, PCI_IDS, 0);
+ }
else
{
memcpy(sep+1, PCI_IDS, sizeof(PCI_IDS));