Mao Zhongyi <maozy.f...@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: jasow...@redhat.com > Cc: j...@resnulli.us > Cc: f4...@amsat.org > Cc: arm...@redhat.com > Signed-off-by: Mao Zhongyi <maozy.f...@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 <arm...@redhat.com>