From: Harmandeep Kaur <write.harmandeep@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, dario.faggioli@citrix.com,
ian.jackson@eu.citrix.com,
Harmandeep Kaur <write.harmandeep@gmail.com>
Subject: [PATCH v3] libxc: fix leak of t_info in xc_tbuf_get_size()
Date: Fri, 12 Feb 2016 16:38:32 +0530 [thread overview]
Message-ID: <1455275312-3515-1-git-send-email-write.harmandeep@gmail.com> (raw)
Avoid leaking the memory mapping of the trace buffer
Coverity ID 1351228
Signed-off-by: Harmandeep Kaur <write.harmandeep@gmail.com>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
---
v2: call to unmapping function reduced to one from two
v3: passed correct argument sysctl.u.tbuf_op.size in
xenforeignmemory_unmap()
---
tools/libxc/xc_tbuf.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c
index 695939a..283fbd1 100644
--- a/tools/libxc/xc_tbuf.c
+++ b/tools/libxc/xc_tbuf.c
@@ -70,11 +70,13 @@ int xc_tbuf_get_size(xc_interface *xch, unsigned long *size)
sysctl.u.tbuf_op.buffer_mfn);
if ( t_info == NULL || t_info->tbuf_size == 0 )
- return -1;
+ rc = -1;
+ else
+ *size = t_info->tbuf_size;
- *size = t_info->tbuf_size;
+ xenforeignmemory_unmap(xch->fmem, t_info, sysctl.u.tbuf_op.size);
- return 0;
+ return rc;
}
int xc_tbuf_enable(xc_interface *xch, unsigned long pages, unsigned long *mfn,
--
2.5.0
next reply other threads:[~2016-02-12 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-12 11:08 Harmandeep Kaur [this message]
2016-02-12 12:34 ` [PATCH v3] libxc: fix leak of t_info in xc_tbuf_get_size() Wei Liu
2016-02-18 11:58 ` 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=1455275312-3515-1-git-send-email-write.harmandeep@gmail.com \
--to=write.harmandeep@gmail.com \
--cc=dario.faggioli@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@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).