diff options
author | vh249@arcadians.cl.cam.ac.uk <vh249@arcadians.cl.cam.ac.uk> | 2005-08-12 10:48:42 +0000 |
---|---|---|
committer | vh249@arcadians.cl.cam.ac.uk <vh249@arcadians.cl.cam.ac.uk> | 2005-08-12 10:48:42 +0000 |
commit | 3abb5c2914ac5e5fe5be5f82854a989bc3e49384 (patch) | |
tree | 64ac4b4b31167d14f27171140306c1e9a5f57afb | |
parent | 31f1ce4923d87282875dc0df2d8d2c649fa87911 (diff) | |
download | xen-3abb5c2914ac5e5fe5be5f82854a989bc3e49384.tar.gz xen-3abb5c2914ac5e5fe5be5f82854a989bc3e49384.tar.bz2 xen-3abb5c2914ac5e5fe5be5f82854a989bc3e49384.zip |
remove pointless NULL checks before free()
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
-rw-r--r-- | tools/libxc/xc_core.c | 3 | ||||
-rw-r--r-- | tools/libxc/xc_linux_build.c | 15 | ||||
-rw-r--r-- | tools/libxc/xc_linux_restore.c | 9 | ||||
-rw-r--r-- | tools/libxc/xc_linux_save.c | 19 | ||||
-rw-r--r-- | tools/libxc/xc_load_elf.c | 3 | ||||
-rw-r--r-- | tools/libxc/xc_vmx_build.c | 12 |
6 files changed, 19 insertions, 42 deletions
diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c index 653512ab92..19f20f65ad 100644 --- a/tools/libxc/xc_core.c +++ b/tools/libxc/xc_core.c @@ -110,7 +110,6 @@ xc_domain_dumpcore(int xc_handle, error_out: if (dump_fd) close(dump_fd); - if (dump_mem_start) - free(dump_mem_start); + free(dump_mem_start); return -1; } diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index 48cace5647..45044c0735 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -318,8 +318,7 @@ static int setup_guest(int xc_handle, return 0; error_out: - if ( page_array != NULL ) - free(page_array); + free(page_array); return -1; } #else /* x86 */ @@ -616,10 +615,8 @@ static int setup_guest(int xc_handle, return 0; error_out: - if ( mmu != NULL ) - free(mmu); - if ( page_array != NULL ) - free(page_array); + free(mmu); + free(page_array); return -1; } #endif @@ -719,8 +716,7 @@ int xc_linux_build(int xc_handle, close(initrd_fd); if ( initrd_gfd ) gzclose(initrd_gfd); - if ( image != NULL ) - free(image); + free(image); #ifdef __ia64__ /* based on new_thread in xen/arch/ia64/domain.c */ @@ -806,8 +802,7 @@ int xc_linux_build(int xc_handle, gzclose(initrd_gfd); else if ( initrd_fd >= 0 ) close(initrd_fd); - if ( image != NULL ) - free(image); + free(image); return -1; } diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c index c2bce43910..c4375c372e 100644 --- a/tools/libxc/xc_linux_restore.c +++ b/tools/libxc/xc_linux_restore.c @@ -607,12 +607,9 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns, out: if ( (rc != 0) && (dom != 0) ) xc_domain_destroy(xc_handle, dom); - if ( mmu != NULL ) - free(mmu); - if ( pfn_to_mfn_table != NULL ) - free(pfn_to_mfn_table); - if ( pfn_type != NULL ) - free(pfn_type); + free(mmu); + free(pfn_to_mfn_table); + free(pfn_type); DPRINTF("Restore exit with rc=%d\n", rc); return rc; diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c index c2a6af5f13..a66ada565d 100644 --- a/tools/libxc/xc_linux_save.c +++ b/tools/libxc/xc_linux_save.c @@ -1051,20 +1051,11 @@ int xc_linux_save(int xc_handle, int io_fd, u32 dom) if(live_mfn_to_pfn_table) munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024); - if (pfn_type != NULL) - free(pfn_type); - - if (pfn_batch != NULL) - free(pfn_batch); - - if (to_send != NULL) - free(to_send); - - if (to_fix != NULL) - free(to_fix); - - if (to_skip != NULL) - free(to_skip); + free(pfn_type); + free(pfn_batch); + free(to_send); + free(to_fix); + free(to_skip); DPRINTF("Save exit rc=%d\n",rc); return !!rc; diff --git a/tools/libxc/xc_load_elf.c b/tools/libxc/xc_load_elf.c index 926db3a964..90417fb2ca 100644 --- a/tools/libxc/xc_load_elf.c +++ b/tools/libxc/xc_load_elf.c @@ -309,8 +309,7 @@ loadelfsymtab( dsi->v_end = round_pgup(maxva); out: - if ( p != NULL ) - free(p); + free(p); return 0; } diff --git a/tools/libxc/xc_vmx_build.c b/tools/libxc/xc_vmx_build.c index 9836746919..ecd1d39b52 100644 --- a/tools/libxc/xc_vmx_build.c +++ b/tools/libxc/xc_vmx_build.c @@ -616,10 +616,8 @@ static int setup_guest(int xc_handle, return 0; error_out: - if ( mmu != NULL ) - free(mmu); - if ( page_array != NULL ) - free(page_array); + free(mmu); + free(page_array); return -1; } @@ -745,8 +743,7 @@ int xc_vmx_build(int xc_handle, close(initrd_fd); if ( initrd_gfd ) gzclose(initrd_gfd); - if ( image != NULL ) - free(image); + free(image); ctxt->flags = VGCF_VMX_GUEST; /* FPU is set up to default initial state. */ @@ -801,8 +798,7 @@ int xc_vmx_build(int xc_handle, gzclose(initrd_gfd); else if ( initrd_fd >= 0 ) close(initrd_fd); - if ( image != NULL ) - free(image); + free(image); return -1; } |