s4 librpc rpc pyrpc: Ensure tevent_context deleted last

Ensure that the tevent_context is deleted after the connection, to
prevent a use after free.

Note: Py_DECREF calls dcerpc_interface_dealloc so the
TALLOC_FREE(ret->mem_ctx) calls in the error paths of
py_dcerpc_interface_init_helper needed removal.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13932

Signed-off-by: Gary Lockyer <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
(cherry picked from commit d65b7641)
24 jobs for gary-bug-13932-v4-10 in 292 minutes and 13 seconds (queued for 1 second)
Status Job ID Name Coverage
  Build
passed #213310811
shared docker
build_ctdb

00:39:08

passed #213310813
shared docker
build_others

00:15:14

passed #213345322
docker private
build_samba

03:38:43

passed #213310818
private docker
build_samba_ad_dc

01:13:25

passed #213310804
shared docker
build_samba_ad_dc_2

00:28:47

passed #213310807
shared docker
build_samba_ad_dc_2_py2

00:23:39

passed #213310805
shared docker
build_samba_ad_dc_backup

00:24:48

passed #213310806
shared docker
build_samba_ad_dc_backup_py2

00:13:26

passed #213310819
private docker
build_samba_ad_dc_py2

00:15:45

passed #213310814
shared docker
build_samba_buildpy2_only

00:16:59

passed #213310812
shared docker
build_samba_ctdb

00:18:44

passed #213310817
private docker
build_samba_fileserver

00:17:07

passed #213310808
shared docker
build_samba_libs

00:17:52

passed #213310809
shared docker
build_samba_libs_py2

00:35:58

passed #213345348
docker shared
build_samba_none_env

00:55:06

passed #213310799
shared docker
build_samba_none_env_py2

00:30:11

passed #213310800
shared docker
build_samba_nopython

00:27:20

passed #213310803
shared docker
build_samba_o3

00:31:51

passed #213310816
private docker
build_samba_py2

01:05:38

passed #213310810
shared docker
build_samba_static

00:40:48

passed #213310801
shared docker
build_samba_systemkrb5

00:14:02

passed #213310802
shared docker
build_samba_xc

00:04:43

failed #213310815
private docker
build_samba

02:01:51

failed #213310798
shared docker
build_samba_none_env

00:45:51