tools/python/xen/lowlevel/xl/xl.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
# HG changeset patch
# User Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
# Date 1291900443 0
# Node ID e4610644ba98610d017d149b0e5aaed2aaecd346
# Parent 5ac189556629e2db96196b2556d870f7cefc959f
pyxl: Fix refcounting of Py_None
Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
diff -r 5ac189556629 -r e4610644ba98 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Thu Dec 09 10:09:59 2010 +0000
+++ b/tools/python/xen/lowlevel/xl/xl.c Thu Dec 09 13:14:03 2010 +0000
@@ -97,8 +97,10 @@ int genwrap__string_set(PyObject *v, cha
PyObject *genwrap__string_get(char **str)
{
- if ( NULL == *str )
+ if ( NULL == *str ) {
+ Py_INCREF(Py_None);
return Py_None;
+ }
return PyString_FromString(*str);
}
@@ -354,6 +356,7 @@ static PyObject *pyxl_list_domains(XlObj
goto err_mem;
memcpy(&di->obj, cur, sizeof(di->obj));
PyList_SetItem(list, i, (PyObject *)di);
+ Py_DECREF(di);
}
free(info);
@@ -389,6 +392,7 @@ static PyObject *pyxl_domain_shutdown(Xl
PyErr_SetString(xl_error_obj, "cannot shutdown domain");
return NULL;
}
+ Py_INCREF(Py_None);
return Py_None;
}
@@ -401,6 +405,7 @@ static PyObject *pyxl_domain_destroy(XlO
PyErr_SetString(xl_error_obj, "cannot destroy domain");
return NULL;
}
+ Py_INCREF(Py_None);
return Py_None;
}
@@ -413,6 +418,7 @@ static PyObject *pyxl_domain_pause(XlObj
PyErr_SetString(xl_error_obj, "cannot pause domain");
return NULL;
}
+ Py_INCREF(Py_None);
return Py_None;
}
@@ -425,6 +431,7 @@ static PyObject *pyxl_domain_unpause(XlO
PyErr_SetString(xl_error_obj, "cannot unpause domain");
return NULL;
}
+ Py_INCREF(Py_None);
return Py_None;
}
@@ -438,6 +445,7 @@ static PyObject *pyxl_domain_rename(XlOb
PyErr_SetString(xl_error_obj, "cannot rename domain");
return NULL;
}
+ Py_INCREF(Py_None);
return Py_None;
}
@@ -457,6 +465,7 @@ static PyObject *pyxl_pci_add(XlObject *
PyErr_SetString(xl_error_obj, "cannot add pci device");
return NULL;
}
+ Py_INCREF(Py_None);
return Py_None;
}
@@ -477,6 +486,7 @@ static PyObject *pyxl_pci_del(XlObject *
PyErr_SetString(xl_error_obj, "cannot remove pci device");
return NULL;
}
+ Py_INCREF(Py_None);
return Py_None;
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|