aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2011-03-29 12:10:53 -0400
committerBorislav Petkov <borislav.petkov@amd.com>2011-03-29 12:19:06 -0400
commita9f0fbe2bbf328f869fc5ee5a12c6a4118c32689 (patch)
tree819fdfb4224ac19a61cb2cd7c7f5a8907306ee82 /drivers
parent89078d572eb9ce8d4c04264b8b0ba86de0d74c8f (diff)
amd64_edac: Fix potential memleak
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. Cc: <stable@kernel.org> # 38.x Reported-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/edac/amd64_edac.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 0be30e978c85..31e71c4fc831 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2679,7 +2679,7 @@ static int __init amd64_edac_init(void)
2679 mcis = kzalloc(amd_nb_num() * sizeof(mcis[0]), GFP_KERNEL); 2679 mcis = kzalloc(amd_nb_num() * sizeof(mcis[0]), GFP_KERNEL);
2680 ecc_stngs = kzalloc(amd_nb_num() * sizeof(ecc_stngs[0]), GFP_KERNEL); 2680 ecc_stngs = kzalloc(amd_nb_num() * sizeof(ecc_stngs[0]), GFP_KERNEL);
2681 if (!(mcis && ecc_stngs)) 2681 if (!(mcis && ecc_stngs))
2682 goto err_ret; 2682 goto err_free;
2683 2683
2684 msrs = msrs_alloc(); 2684 msrs = msrs_alloc();
2685 if (!msrs) 2685 if (!msrs)