提交 71c45122 编写于 作者: R Roland Dreier

IB/ipath: Fix memory leak in init_shadow_tids() error path

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: NRoland Dreier <rolandd@cisco.com>
上级 f3b8436a
...@@ -455,7 +455,7 @@ static void init_shadow_tids(struct ipath_devdata *dd) ...@@ -455,7 +455,7 @@ static void init_shadow_tids(struct ipath_devdata *dd)
if (!addrs) { if (!addrs) {
ipath_dev_err(dd, "failed to allocate shadow dma handle " ipath_dev_err(dd, "failed to allocate shadow dma handle "
"array, no expected sends!\n"); "array, no expected sends!\n");
vfree(dd->ipath_pageshadow); vfree(pages);
dd->ipath_pageshadow = NULL; dd->ipath_pageshadow = NULL;
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册