diff options
author | Mao Zhongyi <maozy.fnst@cn.fujitsu.com> | 2017-08-14 11:33:08 +0800 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2017-09-08 08:17:37 +0800 |
commit | 1343a107e46feed8b901bf08ad8485bd5f302912 (patch) | |
tree | d2e5904884c46145026e82ecd5c7e149b842f8d0 /hw | |
parent | 107e4b352cc309f9bd7588ef1a44549200620078 (diff) | |
download | qemu-1343a107e46feed8b901bf08ad8485bd5f302912.zip qemu-1343a107e46feed8b901bf08ad8485bd5f302912.tar.gz qemu-1343a107e46feed8b901bf08ad8485bd5f302912.tar.bz2 |
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: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/net/rocker/rocker.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index 7496752..9a538a9 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -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: |