From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH] libxc: fix leak in xc_dom_load_hvm_kernel error path
Date: Wed, 3 Feb 2016 11:59:57 +0100 [thread overview]
Message-ID: <1454497197-2134-1-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1454495951.25207.52.camel@citrix.com>
Error path in xc_dom_load_hvm_kernel needs to use the 'error' label instead
of directly returning. This is needed so the entries local variable is
freed.
Coverity-ID: 1351227
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
tools/libxc/xc_dom_hvmloader.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/libxc/xc_dom_hvmloader.c b/tools/libxc/xc_dom_hvmloader.c
index 79a3b99..330d5e8 100644
--- a/tools/libxc/xc_dom_hvmloader.c
+++ b/tools/libxc/xc_dom_hvmloader.c
@@ -257,7 +257,7 @@ static elf_errorstatus xc_dom_load_hvm_kernel(struct xc_dom_image *dom)
if ( rc < 0 )
{
DOMPRINTF("%s: failed to load elf binary", __func__);
- return rc;
+ goto error;
}
munmap(elf->dest_base, elf->dest_size);
@@ -267,14 +267,14 @@ static elf_errorstatus xc_dom_load_hvm_kernel(struct xc_dom_image *dom)
if ( rc != 0 )
{
DOMPRINTF("%s: insufficient space to load modules.", __func__);
- return rc;
+ goto error;
}
rc = loadmodules(dom, m_start, m_end, dom->guest_domid);
if ( rc != 0 )
{
DOMPRINTF("%s: unable to load modules.", __func__);
- return rc;
+ goto error;
}
dom->parms.phys_entry = elf_uval(elf, elf->ehdr, e_entry);
--
2.5.4 (Apple Git-61)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-02-03 11:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <56b180c017d5f_214fb5b3143623f@ss1435.mail>
2016-02-03 10:37 ` Leaks in xc_tbuf_get_size() (Was: Re: New Defects reported by Coverity Scan for XenProject) Ian Campbell
2016-02-03 10:42 ` Andrew Cooper
2016-02-03 10:54 ` Ian Campbell
2016-02-03 14:21 ` George Dunlap
2016-02-03 10:39 ` Leak in xc_dom_load_hvm_kernel() (Was; " Ian Campbell
2016-02-03 10:59 ` Roger Pau Monne [this message]
2016-02-03 11:49 ` [PATCH] libxc: fix leak in xc_dom_load_hvm_kernel error path Ian Campbell
2016-02-03 10:45 ` missing lock in percpu_rwlock? (Was: Re: New Defects reported by Coverity Scan for XenProject) Ian Campbell
2016-02-03 10:47 ` Ian Campbell
2016-02-03 10:50 ` Andrew Cooper
2016-02-03 11:00 ` Ian Campbell
2016-02-03 12:21 ` Andrew Cooper
2016-02-03 12:24 ` Andrew Cooper
2016-02-03 12:32 ` Ian Campbell
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=1454497197-2134-1-git-send-email-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).