summaryrefslogtreecommitdiff
path: root/lib/talloc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-08-28 21:53:27 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-02 13:37:07 +1000
commite7e39584a9dcfd7d98dc10b88baa53019a77e652 (patch)
tree6aa476947258ec5bbd3299c99edc4eee12573e05 /lib/talloc
parent9f5dcb2235b42177bc325a48930917b5d68308e4 (diff)
downloadsamba-e7e39584a9dcfd7d98dc10b88baa53019a77e652.tar.gz
samba-e7e39584a9dcfd7d98dc10b88baa53019a77e652.tar.bz2
samba-e7e39584a9dcfd7d98dc10b88baa53019a77e652.zip
pytalloc: treat a NULL ptr as Py_None
Diffstat (limited to 'lib/talloc')
-rw-r--r--lib/talloc/pytalloc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c
index 92b7b94052..ccf27f5fa0 100644
--- a/lib/talloc/pytalloc.c
+++ b/lib/talloc/pytalloc.c
@@ -68,7 +68,13 @@ PyObject *py_talloc_steal(PyTypeObject *py_type, void *ptr)
*/
PyObject *py_talloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr)
{
- py_talloc_Object *ret = (py_talloc_Object *)py_type->tp_alloc(py_type, 0);
+ py_talloc_Object *ret;
+
+ if (ptr == NULL) {
+ Py_RETURN_NONE;
+ }
+
+ ret = (py_talloc_Object *)py_type->tp_alloc(py_type, 0);
ret->talloc_ctx = talloc_new(NULL);
if (ret->talloc_ctx == NULL) {
return NULL;