From: Markus Armbruster <armbru@redhat.com>
To: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, jasowang@redhat.com, jiri@resnulli.us,
f4bug@amsat.org
Subject: Re: [Qemu-devel] [PATCH v4 2/3] net/rocker: Plug memory leak in pci_rocker_init()
Date: Fri, 19 May 2017 08:26:21 +0200 [thread overview]
Message-ID: <87fug1icqa.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <c1f2bc8f51ab57ad99e103af6b36320ba8980fe2.1495018956.git.maozy.fnst@cn.fujitsu.com> (Mao Zhongyi's message of "Wed, 17 May 2017 19:12:24 +0800")
Mao Zhongyi <maozy.fnst@cn.fujitsu.com> writes:
> 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: f4bug@amsat.org
> Cc: armbru@redhat.com
> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
> ---
> hw/net/rocker/rocker.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
> index b2b6dc7..a382a6f 100644
> --- a/hw/net/rocker/rocker.c
> +++ b/hw/net/rocker/rocker.c
> @@ -1371,7 +1371,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) {
> @@ -1430,6 +1431,7 @@ static int pci_rocker_init(PCIDevice *dev)
>
> return 0;
>
> +err_name_too_long:
> err_duplicate:
> rocker_msix_uninit(r);
> err_msix_init:
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2017-05-19 6:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 11:12 [Qemu-devel] [PATCH v4 0/3] Convert to realize and fix error handling Mao Zhongyi
2017-05-17 11:12 ` [Qemu-devel] [PATCH v4 1/3] net/rocker: Remove the dead " Mao Zhongyi
2017-05-19 6:24 ` Markus Armbruster
2017-05-22 3:47 ` Mao Zhongyi
2017-05-22 6:35 ` Markus Armbruster
2017-05-22 7:43 ` Mao Zhongyi
2017-05-17 11:12 ` [Qemu-devel] [PATCH v4 2/3] net/rocker: Plug memory leak in pci_rocker_init() Mao Zhongyi
2017-05-17 17:22 ` Philippe Mathieu-Daudé
2017-05-18 9:45 ` Mao Zhongyi
2017-05-19 6:26 ` Markus Armbruster [this message]
2017-05-17 11:12 ` [Qemu-devel] [PATCH v4 3/3] net/rocker: Convert to realize() Mao Zhongyi
2017-05-19 7:20 ` Markus Armbruster
2017-05-22 4:17 ` Mao Zhongyi
2017-05-22 6:40 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fug1icqa.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=f4bug@amsat.org \
--cc=jasowang@redhat.com \
--cc=jiri@resnulli.us \
--cc=maozy.fnst@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.