summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2019-08-05 00:28:31 +1200
committerAndreas Schneider <asn@cryptomilk.org>2022-08-26 07:59:32 +0000
commit333e1efa27f1d99bbfc69d94d3bf47e7b99c1e40 (patch)
treec2a88be10ff2fb3482ac6f76bf178cbbb9113d29 /python
parent9aa52bb37e90a00fa38fb5048fd1debb599b03df (diff)
downloadsamba-333e1efa27f1d99bbfc69d94d3bf47e7b99c1e40.tar.gz
samba-333e1efa27f1d99bbfc69d94d3bf47e7b99c1e40.tar.bz2
samba-333e1efa27f1d99bbfc69d94d3bf47e7b99c1e40.zip
pyglue: check talloc buffer for random bytes
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/pyglue.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/python/pyglue.c b/python/pyglue.c
index 0e1bf82fa7a..5ee2b68b8ad 100644
--- a/python/pyglue.c
+++ b/python/pyglue.c
@@ -101,6 +101,10 @@ static PyObject *py_generate_random_bytes(PyObject *self, PyObject *args)
return NULL;
bytes = talloc_zero_size(NULL, len);
+ if (bytes == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
generate_random_buffer(bytes, len);
ret = PyBytes_FromStringAndSize((const char *)bytes, len);
talloc_free(bytes);