Skip to content

Commit

Permalink
IB/ipath: Fix memory leak in init_shadow_tids() error path
Browse files Browse the repository at this point in the history
If the second vmalloc() fails, the wrong pointer is pased to vfree(), so
the first vmalloc() ends up getting leaked.

This was spotted by the Coverity checker (CID 2709).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Roland Dreier committed Feb 23, 2009
1 parent f3b8436 commit 71c4512
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/ipath/ipath_init_chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ static void init_shadow_tids(struct ipath_devdata *dd)
if (!addrs) {
ipath_dev_err(dd, "failed to allocate shadow dma handle "
"array, no expected sends!\n");
vfree(dd->ipath_pageshadow);
vfree(pages);
dd->ipath_pageshadow = NULL;
return;
}
Expand Down

0 comments on commit 71c4512

Please sign in to comment.