mirror of
https://github.com/samba-team/samba.git
synced 2025-03-22 02:50:28 +03:00
pygensec: Fix memory leaks
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> BUG: https://bugzilla.samba.org/show_bug.cgi?id=14817 (cherry picked from commit 814df05f8c10e9d82e6082d42ece1df569db4385)
This commit is contained in:
parent
6cf0b28459
commit
8b281a0553
@ -310,9 +310,13 @@ static PyObject *py_gensec_session_info(PyObject *self,
|
||||
return NULL;
|
||||
}
|
||||
mem_ctx = talloc_new(NULL);
|
||||
if (mem_ctx == NULL) {
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
|
||||
status = gensec_session_info(security, mem_ctx, &info);
|
||||
if (NT_STATUS_IS_ERR(status)) {
|
||||
talloc_free(mem_ctx);
|
||||
PyErr_SetNTSTATUS(status);
|
||||
return NULL;
|
||||
}
|
||||
@ -337,6 +341,9 @@ static PyObject *py_gensec_session_key(PyObject *self,
|
||||
return NULL;
|
||||
}
|
||||
mem_ctx = talloc_new(NULL);
|
||||
if (mem_ctx == NULL) {
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
|
||||
status = gensec_session_key(security, mem_ctx, &session_key);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
@ -466,7 +473,12 @@ static PyObject *py_gensec_update(PyObject *self, PyObject *args)
|
||||
return NULL;
|
||||
|
||||
mem_ctx = talloc_new(NULL);
|
||||
if (mem_ctx == NULL) {
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
|
||||
if (!PyBytes_Check(py_in)) {
|
||||
talloc_free(mem_ctx);
|
||||
PyErr_Format(PyExc_TypeError, "bytes expected");
|
||||
return NULL;
|
||||
}
|
||||
@ -510,8 +522,12 @@ static PyObject *py_gensec_wrap(PyObject *self, PyObject *args)
|
||||
return NULL;
|
||||
|
||||
mem_ctx = talloc_new(NULL);
|
||||
if (mem_ctx == NULL) {
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
|
||||
if (!PyBytes_Check(py_in)) {
|
||||
talloc_free(mem_ctx);
|
||||
PyErr_Format(PyExc_TypeError, "bytes expected");
|
||||
return NULL;
|
||||
}
|
||||
@ -545,8 +561,12 @@ static PyObject *py_gensec_unwrap(PyObject *self, PyObject *args)
|
||||
return NULL;
|
||||
|
||||
mem_ctx = talloc_new(NULL);
|
||||
if (mem_ctx == NULL) {
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
|
||||
if (!PyBytes_Check(py_in)) {
|
||||
talloc_free(mem_ctx);
|
||||
PyErr_Format(PyExc_TypeError, "bytes expected");
|
||||
return NULL;
|
||||
}
|
||||
@ -599,6 +619,9 @@ static PyObject *py_gensec_sign_packet(PyObject *self, PyObject *args)
|
||||
pdu.length = pdu_length;
|
||||
|
||||
mem_ctx = talloc_new(NULL);
|
||||
if (mem_ctx == NULL) {
|
||||
return PyErr_NoMemory();
|
||||
}
|
||||
|
||||
status = gensec_sign_packet(security, mem_ctx,
|
||||
data.data, data.length,
|
||||
|
Loading…
x
Reference in New Issue
Block a user