Skip to content
Snippets Groups Projects
Commit a9f0fbe2 authored by Borislav Petkov's avatar Borislav Petkov
Browse files

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: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
parent 89078d57
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment