Skip to contentSkip to conversation

amd64_edac: Fix potential memleak

PATCH New Borislav Petkov 1 participant 1 message Mar 29, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amd64_edac: Fix potential memleak

From: Borislav Petkov <[email protected]>

We check the pointers together but at least one of them could be invalid due to failed allocation. Since we cannot continue if either of the two allocations has failed, exit early by freeing them both.

---
 drivers/edac/amd64_edac.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/edac/amd64_edac.c +1 -1
index 0be30e9..31e71c4f 100644
@@ -2679,7 +2679,7 @@ static int __init amd64_edac_init(void)
 	mcis	  = kzalloc(amd_nb_num() * sizeof(mcis[0]), GFP_KERNEL);
 	ecc_stngs = kzalloc(amd_nb_num() * sizeof(ecc_stngs[0]), GFP_KERNEL);
 	if (!(mcis && ecc_stngs))
-		goto err_ret;
+		goto err_free;
 
 	msrs = msrs_alloc();
 	if (!msrs)
Signature · 1 line
1.7.4.rc2