git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9f5dcb2
)
pytalloc: treat a NULL ptr as Py_None
author
Andrew Tridgell
<tridge@samba.org>
Sat, 28 Aug 2010 11:53:27 +0000
(21:53 +1000)
committer
Andrew Tridgell
<tridge@samba.org>
Thu, 2 Sep 2010 03:37:07 +0000
(13:37 +1000)
lib/talloc/pytalloc.c
patch
|
blob
|
history
diff --git
a/lib/talloc/pytalloc.c
b/lib/talloc/pytalloc.c
index 92b7b940526854e9fd1080b10a092e4327065907..ccf27f5fa0fe3b9d8ec1f252ad94c31925242965 100644
(file)
--- 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;