summaryrefslogtreecommitdiff
path: root/libgpo/pygpo.c
diff options
context:
space:
mode:
authorSamuel Cabrero <scabrero@samba.org>2022-05-26 17:28:34 +0200
committerJeremy Allison <jra@samba.org>2022-06-27 15:50:30 +0000
commitd0dc0171ad6abd969e834f8eb2bbfc08bef4547a (patch)
tree7291496f38d5f26f4b3e4d822a87350b54193f0c /libgpo/pygpo.c
parent50934b85ffe57ba35e6558a2b54097e64f464419 (diff)
downloadsamba-d0dc0171ad6abd969e834f8eb2bbfc08bef4547a.tar.gz
s3:libads: Allocate ADS_STRUCT under a talloc context
The ads_destroy() function is now static and only called from the ADS_STRUCT destructor. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'libgpo/pygpo.c')
-rw-r--r--libgpo/pygpo.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libgpo/pygpo.c b/libgpo/pygpo.c
index 221900e62fe..710f7fa896d 100644
--- a/libgpo/pygpo.c
+++ b/libgpo/pygpo.c
@@ -142,7 +142,7 @@ typedef struct {
static void py_ads_dealloc(ADS* self)
{
- ads_destroy(&(self->ads_ptr));
+ TALLOC_FREE(self->ads_ptr);
Py_CLEAR(self->py_creds);
Py_TYPE(self)->tp_free((PyObject*)self);
}
@@ -207,11 +207,14 @@ static int py_ads_init(ADS *self, PyObject *args, PyObject *kwds)
/* in case __init__ is called more than once */
if (self->ads_ptr) {
- ads_destroy(&self->ads_ptr);
- self->ads_ptr = NULL;
+ TALLOC_FREE(self->ads_ptr);
}
/* always succeeds or crashes */
- self->ads_ptr = ads_init(realm, workgroup, ldap_server, ADS_SASL_PLAIN);
+ self->ads_ptr = ads_init(pytalloc_get_mem_ctx(args),
+ realm,
+ workgroup,
+ ldap_server,
+ ADS_SASL_PLAIN);
return 0;
}