From: Andrew Walker Date: Mon, 2 Nov 2020 21:42:29 +0000 (-0500) Subject: s4:libnet:py_net - free event context in dealloc fn X-Git-Tag: talloc-2.3.2~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c2fcd83ed7b5cf54b2c5de296a4126ea4e9e155e;p=thirdparty%2Fsamba.git s4:libnet:py_net - free event context in dealloc fn Creation of a new Net() object initializes an event context under a NULL talloc context and then creates a new talloc context as a child of the event context. The deallocation function for the net object only frees the child and not the parent. This leaks an fd for the tevent context and associated memory. Signed-off-by: Andrew Walker Reviewed-by: Jeremy Allison Reviewed-by: Gary Lockyer Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Nov 6 04:58:31 UTC 2020 on sn-devel-184 --- diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c index 25a25b0cfd1..df9280d8c18 100644 --- a/source4/libnet/py_net.c +++ b/source4/libnet/py_net.c @@ -843,7 +843,7 @@ static PyMethodDef net_obj_methods[] = { static void py_net_dealloc(py_net_Object *self) { - talloc_free(self->mem_ctx); + talloc_free(self->ev); PyObject_Del(self); }