Skip to content
Snippets Groups Projects
Commit fa38f9ca authored by Michael Weiser's avatar Michael Weiser
Browse files

Prevent NULL pointer dereference if kadm5_init_with_creds fails

If kadm5_init_with_ccreds failed, the pointer to the kadmin Python object would
be set to NULL but cleanup would still try to use kadmin->context when freeing
princ and closing the ccache.
parent c749f1e8
Branches
Tags
No related merge requests found
......@@ -309,14 +309,6 @@ static PyKAdminObject *_kadmin_init_with_ccache(PyObject *self, PyObject *args)
db_args,
&kadmin->server_handle);
if (retval != KADM5_OK) {
Py_XDECREF(kadmin);
kadmin = NULL;
PyKAdminError_raise_error(retval, "kadm5_init_with_creds");
}
cleanup:
......@@ -328,6 +320,14 @@ cleanup:
krb5_free_principal(kadmin->context, princ);
krb5_cc_close(kadmin->context, cc);
if (retval != KADM5_OK) {
Py_XDECREF(kadmin);
kadmin = NULL;
PyKAdminError_raise_error(retval, "kadm5_init_with_creds");
}
if (params)
free(params);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment