ia64/xen-unstable

changeset 6136:b7ee6eb5000b

remove pointless NULL checks before free()

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vh249@arcadians.cl.cam.ac.uk
date Fri Aug 12 10:48:42 2005 +0000 (2005-08-12)
parents 37ee6b4b409e
children c813cb64d82e
files tools/libxc/xc_core.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_load_elf.c tools/libxc/xc_vmx_build.c
line diff
     1.1 --- a/tools/libxc/xc_core.c	Fri Aug 12 09:14:02 2005 +0000
     1.2 +++ b/tools/libxc/xc_core.c	Fri Aug 12 10:48:42 2005 +0000
     1.3 @@ -110,7 +110,6 @@ xc_domain_dumpcore(int xc_handle,
     1.4   error_out:
     1.5  	if (dump_fd)
     1.6  		close(dump_fd);
     1.7 -	if (dump_mem_start)
     1.8 -		free(dump_mem_start);
     1.9 +	free(dump_mem_start);
    1.10  	return -1;
    1.11  }
     2.1 --- a/tools/libxc/xc_linux_build.c	Fri Aug 12 09:14:02 2005 +0000
     2.2 +++ b/tools/libxc/xc_linux_build.c	Fri Aug 12 10:48:42 2005 +0000
     2.3 @@ -318,8 +318,7 @@ static int setup_guest(int xc_handle,
     2.4      return 0;
     2.5  
     2.6   error_out:
     2.7 -    if ( page_array != NULL )
     2.8 -        free(page_array);
     2.9 +    free(page_array);
    2.10      return -1;
    2.11  }
    2.12  #else /* x86 */
    2.13 @@ -616,10 +615,8 @@ static int setup_guest(int xc_handle,
    2.14      return 0;
    2.15  
    2.16   error_out:
    2.17 -    if ( mmu != NULL )
    2.18 -        free(mmu);
    2.19 -    if ( page_array != NULL )
    2.20 -        free(page_array);
    2.21 +    free(mmu);
    2.22 +    free(page_array);
    2.23      return -1;
    2.24  }
    2.25  #endif
    2.26 @@ -719,8 +716,7 @@ int xc_linux_build(int xc_handle,
    2.27          close(initrd_fd);
    2.28      if ( initrd_gfd )
    2.29          gzclose(initrd_gfd);
    2.30 -    if ( image != NULL )
    2.31 -        free(image);
    2.32 +    free(image);
    2.33  
    2.34  #ifdef __ia64__
    2.35      /* based on new_thread in xen/arch/ia64/domain.c */
    2.36 @@ -806,8 +802,7 @@ int xc_linux_build(int xc_handle,
    2.37          gzclose(initrd_gfd);
    2.38      else if ( initrd_fd >= 0 )
    2.39          close(initrd_fd);
    2.40 -    if ( image != NULL )
    2.41 -        free(image);
    2.42 +    free(image);
    2.43  
    2.44      return -1;
    2.45  }
     3.1 --- a/tools/libxc/xc_linux_restore.c	Fri Aug 12 09:14:02 2005 +0000
     3.2 +++ b/tools/libxc/xc_linux_restore.c	Fri Aug 12 10:48:42 2005 +0000
     3.3 @@ -607,12 +607,9 @@ int xc_linux_restore(int xc_handle, int 
     3.4   out:
     3.5      if ( (rc != 0) && (dom != 0) )
     3.6          xc_domain_destroy(xc_handle, dom);
     3.7 -    if ( mmu != NULL )
     3.8 -        free(mmu);
     3.9 -    if ( pfn_to_mfn_table != NULL )
    3.10 -        free(pfn_to_mfn_table);
    3.11 -    if ( pfn_type != NULL )
    3.12 -        free(pfn_type);
    3.13 +    free(mmu);
    3.14 +    free(pfn_to_mfn_table);
    3.15 +    free(pfn_type);
    3.16  
    3.17      DPRINTF("Restore exit with rc=%d\n", rc);
    3.18      return rc;
     4.1 --- a/tools/libxc/xc_linux_save.c	Fri Aug 12 09:14:02 2005 +0000
     4.2 +++ b/tools/libxc/xc_linux_save.c	Fri Aug 12 10:48:42 2005 +0000
     4.3 @@ -1051,20 +1051,11 @@ int xc_linux_save(int xc_handle, int io_
     4.4      if(live_mfn_to_pfn_table) 
     4.5          munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024);
     4.6  
     4.7 -    if (pfn_type != NULL) 
     4.8 -        free(pfn_type);
     4.9 -
    4.10 -    if (pfn_batch != NULL)
    4.11 -        free(pfn_batch);
    4.12 -
    4.13 -    if (to_send != NULL)
    4.14 -        free(to_send);
    4.15 -
    4.16 -    if (to_fix != NULL)
    4.17 -        free(to_fix);
    4.18 -
    4.19 -    if (to_skip != NULL)
    4.20 -       free(to_skip);
    4.21 +    free(pfn_type);
    4.22 +    free(pfn_batch);
    4.23 +    free(to_send);
    4.24 +    free(to_fix);
    4.25 +    free(to_skip);
    4.26  
    4.27      DPRINTF("Save exit rc=%d\n",rc);
    4.28      return !!rc;
     5.1 --- a/tools/libxc/xc_load_elf.c	Fri Aug 12 09:14:02 2005 +0000
     5.2 +++ b/tools/libxc/xc_load_elf.c	Fri Aug 12 10:48:42 2005 +0000
     5.3 @@ -309,8 +309,7 @@ loadelfsymtab(
     5.4      dsi->v_end = round_pgup(maxva);
     5.5  
     5.6   out:
     5.7 -    if ( p != NULL )
     5.8 -        free(p);
     5.9 +    free(p);
    5.10  
    5.11      return 0;
    5.12  }
     6.1 --- a/tools/libxc/xc_vmx_build.c	Fri Aug 12 09:14:02 2005 +0000
     6.2 +++ b/tools/libxc/xc_vmx_build.c	Fri Aug 12 10:48:42 2005 +0000
     6.3 @@ -616,10 +616,8 @@ static int setup_guest(int xc_handle,
     6.4      return 0;
     6.5  
     6.6   error_out:
     6.7 -    if ( mmu != NULL )
     6.8 -        free(mmu);
     6.9 -    if ( page_array != NULL )
    6.10 -        free(page_array);
    6.11 +    free(mmu);
    6.12 +    free(page_array);
    6.13      return -1;
    6.14  }
    6.15  
    6.16 @@ -745,8 +743,7 @@ int xc_vmx_build(int xc_handle,
    6.17          close(initrd_fd);
    6.18      if ( initrd_gfd )
    6.19          gzclose(initrd_gfd);
    6.20 -    if ( image != NULL )
    6.21 -        free(image);
    6.22 +    free(image);
    6.23  
    6.24      ctxt->flags = VGCF_VMX_GUEST;
    6.25      /* FPU is set up to default initial state. */
    6.26 @@ -801,8 +798,7 @@ int xc_vmx_build(int xc_handle,
    6.27          gzclose(initrd_gfd);
    6.28      else if ( initrd_fd >= 0 )
    6.29          close(initrd_fd);
    6.30 -    if ( image != NULL )
    6.31 -        free(image);
    6.32 +    free(image);
    6.33  
    6.34      return -1;
    6.35  }