summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
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);