提交 1343a107 编写于 作者: M Mao Zhongyi 提交者: Jason Wang

net/rocker: Plug memory leak in pci_rocker_init()

pci_rocker_init() leaks a World when the name more than 9 chars,
then return a negative value directly, doesn't make a correct
cleanup. So add a new goto label to fix it.

Cc: jasowang@redhat.com
Cc: jiri@resnulli.us
Cc: armbru@redhat.com
Cc: f4bug@amsat.org
Signed-off-by: NMao Zhongyi <maozy.fnst@cn.fujitsu.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: NJason Wang <jasowang@redhat.com>
上级 107e4b35
......@@ -1355,7 +1355,8 @@ static int pci_rocker_init(PCIDevice *dev)
fprintf(stderr,
"rocker: name too long; please shorten to at most %d chars\n",
MAX_ROCKER_NAME_LEN);
return -EINVAL;
err = -EINVAL;
goto err_name_too_long;
}
if (memcmp(&r->fp_start_macaddr, &zero, sizeof(zero)) == 0) {
......@@ -1414,6 +1415,7 @@ static int pci_rocker_init(PCIDevice *dev)
return 0;
err_name_too_long:
err_duplicate:
rocker_msix_uninit(r);
err_msix_init:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册