From: Alex Jia Date: Wed, 30 Nov 2011 05:57:12 +0000 (+0800) Subject: util: Plug memory leak on virNetDevMacVLanCreateWithVPortProfile() error path X-Git-Tag: v0.9.8-rc1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c8327994c4eeafb4ab675845031556fdfb7489a;p=thirdparty%2Flibvirt.git util: Plug memory leak on virNetDevMacVLanCreateWithVPortProfile() error path Detected by Coverity. Leak introduced in commit 90074ec. Signed-off-by: Alex Jia Signed-off-by: Eric Blake --- diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index 12fc411b8a..5e55b723bb 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -582,7 +582,10 @@ create_name: virNetDevError(VIR_ERR_INTERNAL_ERROR, _("cannot set bandwidth limits on %s"), cr_ifname); - rc = -1; + if (withTap) + VIR_FORCE_CLOSE(rc); /* sets rc to -1 */ + else + rc = -1; goto disassociate_exit; }