From: Stefan Metzmacher Date: Tue, 28 Jan 2025 09:20:08 +0000 (+0100) Subject: pidl:Python: check PyTuple_New() return value X-Git-Tag: samba-4.20.8~47 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba7115254ef724480e5b3b9ae7c117931c4ee03f;p=thirdparty%2Fsamba.git pidl:Python: check PyTuple_New() return value BUG: https://bugzilla.samba.org/show_bug.cgi?id=14213 Signed-off-by: Stefan Metzmacher Reviewed-by: Douglas Bagnall (cherry picked from commit f7282c0dffbf30d72051a81d46d831344a9bbcf9) --- diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index e024b19a19a..efa5fa83e73 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -992,6 +992,12 @@ sub PythonFunctionUnpackOut($$$) if ($result_size > 1) { $self->pidl("result = PyTuple_New($result_size);"); + $self->pidl("if (result == NULL) {"); + $self->indent; + $self->pidl("return NULL;"); + $self->deindent; + $self->pidl("}"); + $self->pidl(""); $signature .= "("; } elsif ($result_size == 0) { $self->pidl("result = Py_None;");