]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
xen.lowlevel.xl: Return None on empty domain name
authorMarek Marczykowski <marmarek@mimuw.edu.pl>
Sun, 5 Jun 2011 14:53:03 +0000 (16:53 +0200)
committerMarek Marczykowski <marmarek@mimuw.edu.pl>
Sun, 5 Jun 2011 14:53:03 +0000 (16:53 +0200)
Previously PyString_FromString(NULL) was called, which caused assertion
failure.

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
xen-unstable changest: 23606:cc2f376d0cd9
Backport-requested-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/python/xen/lowlevel/xl/xl.c

index 14ad809f0f7603ea5b16e78e2671ff8b13a94e1f..a637a65fb7de2b791db643012b2e7866452024d8 100644 (file)
@@ -412,14 +412,16 @@ static PyObject *pyxl_domid_to_name(XlObject *self, PyObject *args)
 {
     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;
 }