[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] remove pointless NULL checks before free()



# HG changeset patch
# User vh249@xxxxxxxxxxxxxxxxxxxxxx
# Node ID b7ee6eb5000b6960e4541d356a7de029ee305836
# Parent  37ee6b4b409e67001d2c3054e9300bc08bc49fa9
remove pointless NULL checks before free()

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r 37ee6b4b409e -r b7ee6eb5000b tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     Fri Aug 12 09:14:02 2005
+++ b/tools/libxc/xc_core.c     Fri Aug 12 10:48:42 2005
@@ -110,7 +110,6 @@
  error_out:
        if (dump_fd)
                close(dump_fd);
-       if (dump_mem_start)
-               free(dump_mem_start);
+       free(dump_mem_start);
        return -1;
 }
diff -r 37ee6b4b409e -r b7ee6eb5000b tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Fri Aug 12 09:14:02 2005
+++ b/tools/libxc/xc_linux_build.c      Fri Aug 12 10:48:42 2005
@@ -318,8 +318,7 @@
     return 0;
 
  error_out:
-    if ( page_array != NULL )
-        free(page_array);
+    free(page_array);
     return -1;
 }
 #else /* x86 */
@@ -616,10 +615,8 @@
     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 @@
         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 @@
         gzclose(initrd_gfd);
     else if ( initrd_fd >= 0 )
         close(initrd_fd);
-    if ( image != NULL )
-        free(image);
+    free(image);
 
     return -1;
 }
diff -r 37ee6b4b409e -r b7ee6eb5000b tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Fri Aug 12 09:14:02 2005
+++ b/tools/libxc/xc_linux_restore.c    Fri Aug 12 10:48:42 2005
@@ -607,12 +607,9 @@
  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 -r 37ee6b4b409e -r b7ee6eb5000b tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       Fri Aug 12 09:14:02 2005
+++ b/tools/libxc/xc_linux_save.c       Fri Aug 12 10:48:42 2005
@@ -1051,20 +1051,11 @@
     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 -r 37ee6b4b409e -r b7ee6eb5000b tools/libxc/xc_load_elf.c
--- a/tools/libxc/xc_load_elf.c Fri Aug 12 09:14:02 2005
+++ b/tools/libxc/xc_load_elf.c Fri Aug 12 10:48:42 2005
@@ -309,8 +309,7 @@
     dsi->v_end = round_pgup(maxva);
 
  out:
-    if ( p != NULL )
-        free(p);
+    free(p);
 
     return 0;
 }
diff -r 37ee6b4b409e -r b7ee6eb5000b tools/libxc/xc_vmx_build.c
--- a/tools/libxc/xc_vmx_build.c        Fri Aug 12 09:14:02 2005
+++ b/tools/libxc/xc_vmx_build.c        Fri Aug 12 10:48:42 2005
@@ -616,10 +616,8 @@
     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 @@
         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 @@
         gzclose(initrd_gfd);
     else if ( initrd_fd >= 0 )
         close(initrd_fd);
-    if ( image != NULL )
-        free(image);
+    free(image);
 
     return -1;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.