From dc20e7c6df7a230c3b3cd9ae7de79e4cacc36eb4 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Tue, 9 Jul 2019 09:44:12 +0000 Subject: talloc: pytalloc_get_checked_type: survive non-talloc objects If the python object is not a talloc object, we will end up with a NULL pointer. We weren't checking for that properly Signed-off-by: Douglas Bagnall Reviewed-by: Gary Lockyer Reviewed-by: Andrew Bartlett --- lib/talloc/pytalloc_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/talloc') diff --git a/lib/talloc/pytalloc_util.c b/lib/talloc/pytalloc_util.c index 82b95e7f144..4193ca895ce 100644 --- a/lib/talloc/pytalloc_util.c +++ b/lib/talloc/pytalloc_util.c @@ -247,7 +247,7 @@ static void *_pytalloc_get_checked_type(PyObject *py_obj, const char *type_name, mem_ctx = _pytalloc_get_mem_ctx(py_obj); ptr = _pytalloc_get_ptr(py_obj); - if (mem_ctx != ptr) { + if (mem_ctx != ptr || ptr == NULL) { if (check_only) { return NULL; } -- cgit v1.2.1