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-devel

[Xen-devel] [PATCH 5 of 6 RESENT] xen.lowlevel.xl: Return None on empty

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 5 of 6 RESENT] xen.lowlevel.xl: Return None on empty domain name
From: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
Date: Sun, 05 Jun 2011 18:50:35 +0200
Cc: marmarek@xxxxxxxxxxxx
Delivery-date: Sun, 05 Jun 2011 10:01:52 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1307292630@devel14>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1307292630@devel14>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.8.2
# HG changeset patch
# User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
# Date 1307145131 -7200
# Node ID 0c0f9e1bd14073b5cb1d4f58b6950d16128003fa
# Parent  0863dfd23b3a10bee6d3eda30415dff0eef2bee1
xen.lowlevel.xl: Return None on empty domain name

Previously PyString_FromString(NULL) was called, which caused assertion
failure.

Signed-off-by: Marek Marczykowski <marmarek@xxxxxxxxxxxx>

diff -r 0863dfd23b3a -r 0c0f9e1bd140 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Sat Jun 04 01:50:42 2011 +0200
+++ b/tools/python/xen/lowlevel/xl/xl.c Sat Jun 04 01:52:11 2011 +0200
@@ -409,14 +409,16 @@ static PyObject *pyxl_domid_to_name(XlOb
 {
     char *domname;
     int domid;
-    PyObject *ret;
+    PyObject *ret = Py_None;
 
     if ( !PyArg_ParseTuple(args, "i", &domid) )
         return NULL;
 
     domname = libxl_domid_to_name(self->ctx, domid);
-    ret = PyString_FromString(domname);
-    free(domname);
+    if (domname) {
+        ret = PyString_FromString(domname);
+        free(domname);
+    }
 
     return ret;
 }



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

<Prev in Thread] Current Thread [Next in Thread>