From: Borislav Petkov Date: Tue, 29 Mar 2011 16:10:53 +0000 (+0200) Subject: amd64_edac: Fix potential memleak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a9f0fbe2bbf328f869fc5ee5a12c6a4118c32689;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: # 38.x Reported-by: Mauro Carvalho Chehab Signed-off-by: Borislav Petkov --- 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) 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)