]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/names-parse.c
libpci: windows: Define ERROR_NOT_FOUND
[pciutils.git] / lib / names-parse.c
index 58ab578e0e9f2d1775fb2f75a7ce49f74bb17155..c86f8af3462f158b9ffabadffaf2dff1bcf1481a 100644 (file)
@@ -30,7 +30,7 @@ static pci_file pci_open(struct pci_access *a)
   if (result)
     return result;
   len = strlen(a->id_file_name);
-  if (len >= 3 && memcmp(a->id_file_name + len - 3, ".gz", 3) != 0)
+  if (len < 3 || memcmp(a->id_file_name + len - 3, ".gz", 3) != 0)
     return result;
   new_name = malloc(len - 2);
   memcpy(new_name, a->id_file_name, len - 3);
@@ -42,7 +42,7 @@ static pci_file pci_open(struct pci_access *a)
 #define pci_close(f)           gzclose(f)
 #define PCI_ERROR(f, err)                                              \
        if (!err) {                                                     \
-               int errnum;                                             \
+               int errnum = 0;                                         \
                gzerror(f, &errnum);                                    \
                if (errnum >= 0) err = NULL;                            \
                else if (errnum == Z_ERRNO) err = "I/O error";          \
@@ -238,6 +238,7 @@ pci_free_name_list(struct pci_access *a)
 {
   pci_id_cache_flush(a);
   pci_id_hash_free(a);
+  pci_id_hwdb_free(a);
   a->id_load_failed = 0;
 }