Skip to content

Commit

Permalink
amd64_edac: Fix potential memleak
Browse files Browse the repository at this point in the history
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: <[email protected]> # 38.x
Reported-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
  • Loading branch information
Borislav Petkov committed Mar 29, 2011
1 parent 89078d5 commit a9f0fbe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/edac/amd64_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a9f0fbe

Please sign in to comment.