aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/python/xen/lowlevel/xl/xl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/python/xen/lowlevel/xl/xl.c b/tools/python/xen/lowlevel/xl/xl.c
index 051b5eb476..b33fb94526 100644
--- a/tools/python/xen/lowlevel/xl/xl.c
+++ b/tools/python/xen/lowlevel/xl/xl.c
@@ -409,13 +409,14 @@ 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);
+ if (domname)
+ ret = PyString_FromString(domname);
free(domname);
return ret;