free(NULL);
Quoted 46 lines · Xen patchbot -unstable
# HG changeset patch
# User [email protected]
# Node IDe436e4e93076c8f4c434b9531b70179b90347b48
# Parentbdb8c00ddb852fc6eab2175b7e3738d015ec2738
Add some minor defensive coding/error handling inxc_vmx_build.clike C/S 7687Signed-off-by Haifeng Xue <[email protected]>Signed-off-by Xin Li <[email protected]>diff -r
bdb8c00ddb85-re436e4e93076tools/libxc/xc_vmx_build.ctools/libxc/xc_vmx_build.c +7
-4@@ -565,8 +565,10 @@return 0 ; error_out: -free (mmu); -free (page_array); +if ( mmu !=NULL ) +free (mmu); +if ( page_array !=NULL ) +free (page_array);return -1 ; }@@ -627,7 +629,7 @@if (mlock (&st_ctxt,sizeof (st_ctxt) ) ) { -PERROR ("xc_vmx_build: ctxt mlock failed" ); +PERROR ("%s: ctxt mlock failed" , __func__);return 1 ; }@@ -661,7 +663,8 @@ goto error_out; } -free (image); +if ( image !=NULL ) +free (image); ctxt->flags =VGCF_VMX_GUEST ;/* FPU is set up to default initial state. */
tools/libxc/xc_vmx_build.c line 717
Quoted 9 lines
tools/libxc/xc_vmx_build.c +2
-1@@ -707,7 +710,8 @@return rc; error_out: -free (image); +if ( image !=NULL ) +free (image);return -1 ; }
free(3) explicitly handles NULL pointers (see the man page), so most of this patch should be reverted. (If I could find an email address for [email protected], who checked in changeset 7687:913ad6d48cbc, I'd CC them as well.)
For that matter, so does xfree(), and it looks like the ACM code in particular has the same problem.
I don't want to submit a patch I haven't tested, so this should be an easy cleanup for somebody...
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center