From: Douglas Bagnall Date: Tue, 24 Apr 2018 00:38:22 +0000 (+1200) Subject: s4/pyauth: fix memory leak when context_new() has bad arguments X-Git-Tag: ldb-1.6.1~242 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f9ac9135c4d4e6173ac2d39b93b8d96e1f038ee;p=thirdparty%2Fsamba.git s4/pyauth: fix memory leak when context_new() has bad arguments Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/auth/pyauth.c b/source4/auth/pyauth.c index 0736859092c..861b6983c9c 100644 --- a/source4/auth/pyauth.c +++ b/source4/auth/pyauth.c @@ -361,12 +361,14 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec lp_ctx = lpcfg_from_py_object(mem_ctx, py_lp_ctx); if (lp_ctx == NULL) { + talloc_free(mem_ctx); PyErr_NoMemory(); return NULL; } ev = s4_event_context_init(mem_ctx); if (ev == NULL) { + talloc_free(mem_ctx); PyErr_NoMemory(); return NULL; }