retstr = generate_random_password(NULL, min, max);
if (retstr == NULL) {
if (errno == EINVAL) {
- PyErr_Format(PyExc_ValueError,
- "invalid range: %zd - %zd",
- min, max);
+ return PyErr_Format(PyExc_ValueError,
+ "invalid range: %zd - %zd",
+ min, max);
}
- return NULL;
+ return PyErr_NoMemory();
}
ret = PyUnicode_FromString(retstr);
talloc_free(retstr);
retstr = generate_random_machine_password(NULL, min, max);
if (retstr == NULL) {
if (errno == EINVAL) {
- PyErr_Format(PyExc_ValueError,
- "invalid range: %zd - %zd",
- min, max);
+ return PyErr_Format(PyExc_ValueError,
+ "invalid range: %zd - %zd",
+ min, max);
}
- return NULL;
+ return PyErr_NoMemory();
}
ret = PyUnicode_FromString(retstr);
talloc_free(retstr);
lp_ctx = lpcfg_from_py_object(tmp_ctx, py_lp_ctx);
if (lp_ctx == NULL) {
talloc_free(tmp_ctx);
- return NULL;
+ return PyErr_NoMemory();
}
load_interface_list(tmp_ctx, lp_ctx, &ifaces);