tools/libxc: Fix memory leaks in xc_domain_restore()
PATCH 1/1 tools/libxc: Fix memory leaks in xc_domain_restore()
# HG changeset patch
# User Andrew Cooper <[email protected]> # Date 1371832526 -3600
# Node ID cec58839d6eff0ac27de3827af8fc969db554172 # Parent 803ad8977a817263ea826bac1bb68c0dd57fac9c tools/libxc: Fix memory leaks in xc_domain_restore()
---
George: I believe these qualify under #2 for inclusion into 4.3
Ian: These should be backported to 4.2 and 4.1
I will have a patch against xc_domain_save() soon, but it is proving more difficult and I am not certain I will have time to finish it soon.
tools/libxc/xc_domain_restore.c +3 -0
@@ -2335,6 +2335,9 @@ int xc_domain_restore(xc_interface *xch,free (mmu);free (ctx->p2m);free (pfn_type); +free (region_mfn); +free (ctx->p2m_batch); +pagebuf_free (&pagebuf);tailbuf_free (&tailbuf);/* discard cache for save file */
Andrew Cooper writes ("[PATCH] tools/libxc: Fix memory leaks in xc_domain_restore()"):
Quoted 3 lines
tools/libxc: Fix memory leaks inxc_domain_restore()+
free(region_mfn);
...
Quoted 1 line
+
pagebuf_free(&pagebuf);
These look correct to me.
But as regards
Quoted 1 line
+
free(ctx->p2m_batch);
It's not clear to me where that's initialised. It needs to be initialised to NULL I think.
Ian.
Quoted 7 lines · Ian Jackson
Andrew Cooper writes ("[PATCH]
tools/libxc: Fix memory leaks inxc_domain_restore()"):Quoted 2 lines
tools/libxc: Fix memory leaks inxc_domain_restore()
+free(region_mfn);...
Quoted 1 line
+
pagebuf_free(&pagebuf);These look correct to me.
Quoted 7 lines
But as regards
Quoted 1 line
+
free(ctx->p2m_batch);It's not clear to me where that's initialised. It needs to be initialised to NULL I think.
Ian.
It is initialised in memset(ctx, 0, sizeof(*ctx)) at the top of the function.
~Andrew
Ian Jackson
Acked-byRe: [PATCH] tools/libxc: Fix memory leaks in xc_domain_restore() [and 1 more messages]
Andrew Cooper writes ("Re: [PATCH] tools/libxc: Fix memory leaks in xc_domain_restore()"):
Quoted 3 lines · Ian Jackson
Quoted 2 lines
It's not clear to me where that's initialised. It needs to be initialised to NULL I think.
...
Quoted 2 lines
It is initialised in
memset(ctx, 0, sizeof(*ctx))at the top of the function.
Oh, yes.
George Dunlap writes ("Re: [Xen-devel] [PATCH] tools/libxc: Fix memory leaks in> Re the release:
Quoted 2 lines
Acked-by George Dunlap <[email protected]>
Thanks, committed.
Ian.
Quoted 7 lines · Andrew Cooper
# HG changeset patch
# User Andrew Cooper <[email protected]> # Date 1371832526 -3600
# Node IDcec58839d6eff0ac27de3827af8fc969db554172# Parent803ad8977a817263ea826bac1bb68c0dd57fac9ctools/libxc: Fix memory leaks inxc_domain_restore()
Quoted 5 lines
Signed-off-by Andrew Cooper <[email protected]>---
George: I believe these qualify under #2 for inclusion into 4.3
Yes, looks good:
Re the release:
Quoted 24 lines
Ian: These should be backported to 4.2 and 4.1
I will have a patch against
xc_domain_save()soon, but it is proving more difficult and I am not certain I will have time to finish it soon.diff -r
803ad8977a81-rcec58839d6eftools/libxc/xc_domain_restore.ctools/libxc/xc_domain_restore.c +3
-0@@ -2335,6 +2335,9 @@ int xc_domain_restore(xc_interface *xch,free (mmu);free (ctx->p2m);free (pfn_type); +free (region_mfn); +free (ctx->p2m_batch); +pagebuf_free (&pagebuf);tailbuf_free (&tailbuf);/* discard cache for save file */ _______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel