From 4c8327994c4eeafb4ab675845031556fdfb7489a Mon Sep 17 00:00:00 2001 From: Alex Jia Date: Wed, 30 Nov 2011 13:57:12 +0800 Subject: [PATCH] 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 --- src/util/virnetdevmacvlan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; }