libxc: fix leak of t_info in xc_tbuf_get_size()
PATCH v3 1/1 libxc: fix leak of t_info in xc_tbuf_get_size()
Avoid leaking the memory mapping of the trace buffer
Coverity ID 1351228
Signed-off-by Harmandeep Kaur <[email protected]>
Reviewed-by Dario Faggioli <[email protected]>
---
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(-)
tools/libxc/xc_tbuf.c +5 -3
@@ -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,
Signature · 1 line
2.5.0
Quoted 6 lines · Harmandeep Kaur
Avoid leaking the memory mapping of the trace buffer
Coverity ID 1351228
Signed-off-by Harmandeep Kaur <[email protected]>Reviewed-by Dario Faggioli <[email protected]>
Acked-by Wei Liu <[email protected]>
Thanks
Ian Campbell
AppliedQuoted 9 lines · Wei Liu
Quoted 6 lines · Harmandeep Kaur
Avoid leaking the memory mapping of the trace buffer
Coverity ID 1351228
Signed-off-by Harmandeep Kaur <[email protected]>Reviewed-by Dario Faggioli <[email protected]>Acked-by Wei Liu <[email protected]>
Applied, thanks.
Ian.