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

[Xen-changelog] remove redundant NULL check before xfree()



ChangeSet 1.1386, 2005/04/26 14:37:38+01:00, vh249@xxxxxxxxxxxxxxxxxxxxxx

        remove redundant NULL check before xfree()
        
        Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>



 arch/x86/shadow.c    |    4 ++--
 common/dom0_ops.c    |    3 +--
 common/domain.c      |    6 ++----
 common/grant_table.c |    3 +--
 common/physdev.c     |    7 ++-----
 5 files changed, 8 insertions(+), 15 deletions(-)


diff -Nru a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c     2005-04-28 06:02:41 -04:00
+++ b/xen/arch/x86/shadow.c     2005-04-28 06:02:41 -04:00
@@ -981,12 +981,12 @@
     return 0;
 
  nomem:
-    if ( (new_modes & SHM_enable) && (d->arch.shadow_ht != NULL) )
+    if ( (new_modes & SHM_enable) )
     {
         xfree(d->arch.shadow_ht);
         d->arch.shadow_ht = NULL;
     }
-    if ( (new_modes & SHM_log_dirty) && (d->arch.shadow_dirty_bitmap != NULL) )
+    if ( (new_modes & SHM_log_dirty) )
     {
         xfree(d->arch.shadow_dirty_bitmap);
         d->arch.shadow_dirty_bitmap = NULL;
diff -Nru a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     2005-04-28 06:02:41 -04:00
+++ b/xen/common/dom0_ops.c     2005-04-28 06:02:41 -04:00
@@ -349,8 +349,7 @@
             if ( copy_to_user(op->u.getdomaininfo.ctxt, c, sizeof(*c)) )
                 ret = -EINVAL;
 
-            if ( c != NULL )
-                xfree(c);
+            xfree(c);
         }
 
         if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )     
diff -Nru a/xen/common/domain.c b/xen/common/domain.c
--- a/xen/common/domain.c       2005-04-28 06:02:41 -04:00
+++ b/xen/common/domain.c       2005-04-28 06:02:41 -04:00
@@ -257,8 +257,7 @@
     set_bit(DF_CONSTRUCTED, &p->d_flags);
 
  out:    
-    if ( c != NULL )
-        xfree(c);
+    xfree(c);
     return rc;
 }
 
@@ -313,8 +312,7 @@
     return 0;
 
  out:
-    if ( c != NULL )
-        xfree(c);
+    xfree(c);
     arch_free_exec_domain_struct(d->exec_domain[vcpu]);
     d->exec_domain[vcpu] = NULL;
     return rc;
diff -Nru a/xen/common/grant_table.c b/xen/common/grant_table.c
--- a/xen/common/grant_table.c  2005-04-28 06:02:41 -04:00
+++ b/xen/common/grant_table.c  2005-04-28 06:02:41 -04:00
@@ -1122,8 +1122,7 @@
  no_mem:
     if ( t != NULL )
     {
-        if ( t->active != NULL )
-            xfree(t->active);
+        xfree(t->active);
         if ( t->maptrack != NULL )
             free_xenheap_page((unsigned long)t->maptrack);
         xfree(t);
diff -Nru a/xen/common/physdev.c b/xen/common/physdev.c
--- a/xen/common/physdev.c      2005-04-28 06:02:41 -04:00
+++ b/xen/common/physdev.c      2005-04-28 06:02:41 -04:00
@@ -146,11 +146,8 @@
 {
     struct list_head *ent;
 
-    if ( d->arch.iobmp_mask != NULL )
-    {
-        xfree(d->arch.iobmp_mask);
-        d->arch.iobmp_mask = NULL;
-    }
+    xfree(d->arch.iobmp_mask);
+    d->arch.iobmp_mask = NULL;
 
     while ( (ent = d->pcidev_list.next) != &d->pcidev_list )
     {

_______________________________________________
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®.