s4:libnet:py_net - free event context in dealloc fn
authorAndrew Walker <awalker@ixsystems.com>
Mon, 2 Nov 2020 21:42:29 +0000 (16:42 -0500)
committerJeremy Allison <jra@samba.org>
Fri, 6 Nov 2020 04:58:31 +0000 (04:58 +0000)
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 <awalker@ixsystems.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov  6 04:58:31 UTC 2020 on sn-devel-184

source4/libnet/py_net.c

index 25a25b0cfd11521ec5671b31af65fd9a0816564a..df9280d8c18deda6d4188f017db40c1191d2a806 100644 (file)
@@ -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);
 }