[PATCH] PCI: fix potential resource leak in drivers/pci/msi.c
authorJesper Juhl <jesper.juhl@gmail.com>
Mon, 17 Apr 2006 02:02:54 +0000 (04:02 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 27 Apr 2006 20:00:51 +0000 (13:00 -0700)
The coverity checker spotted (as entry #599) that we might leak `entry' in
drivers/pci/msi.c::msix_capability_init()
This patch should take care of that.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/msi.c

index 2087a397ef16768d09498ab326a300b12ec14744..9855c4c920b82af7f106e0afb251f5251a5f032a 100644 (file)
@@ -793,8 +793,10 @@ static int msix_capability_init(struct pci_dev *dev,
                if (!entry)
                        break;
                vector = get_msi_vector(dev);
-               if (vector < 0)
+               if (vector < 0) {
+                       kmem_cache_free(msi_cachep, entry);
                        break;
+               }
 
                j = entries[i].entry;
                entries[i].vector = vector;