WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add some minor defensive coding/error handling in xc_vmx

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add some minor defensive coding/error handling in xc_vmx_build.c like
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Nov 2005 17:06:15 +0000
Delivery-date: Thu, 10 Nov 2005 17:07:45 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID e436e4e93076c8f4c434b9531b70179b90347b48
# Parent  bdb8c00ddb852fc6eab2175b7e3738d015ec2738
Add some minor defensive coding/error handling in xc_vmx_build.c like
C/S 7687

Signed-off-by: Haifeng Xue <haifeng.xue@xxxxxxxxx>
Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>

diff -r bdb8c00ddb85 -r e436e4e93076 tools/libxc/xc_vmx_build.c
--- a/tools/libxc/xc_vmx_build.c        Thu Nov 10 11:05:22 2005
+++ b/tools/libxc/xc_vmx_build.c        Thu Nov 10 11:06:50 2005
@@ -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. */
@@ -707,7 +710,8 @@
     return rc;
 
  error_out:
-    free(image);
+    if ( image != NULL )
+        free(image);
 
     return -1;
 }

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add some minor defensive coding/error handling in xc_vmx_build.c like, Xen patchbot -unstable <=