Skip to contentSkip to conversation

fix potential resource leak in drivers/pci/msi.c

PATCH New Jesper Juhl 1 participant 1 message Apr 17, 2006 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix potential resource leak in drivers/pci/msi.c

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.

---

drivers/pci/msi.c +3 -1
@@ -793,8 +793,10 @@ static int msix_capability_init(struct p
 		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;