]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pygpo: Make ads_ADSType object inherit from pytalloc_BaseObject
authorSamuel Cabrero <scabrero@samba.org>
Tue, 24 May 2022 10:44:36 +0000 (12:44 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 27 Jun 2022 15:50:29 +0000 (15:50 +0000)
Prepare to allocate ADS_STRUCT under a talloc context.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libgpo/pygpo.c

index b5ec85a48d41258a0c400f0c8b6578ffc46fd4f3..221900e62fedf8617de5d458aaeccc8666704ddc 100644 (file)
@@ -29,6 +29,7 @@
 #include "libcli/util/pyerrors.h"
 #include "python/py3compat.h"
 #include "python/modules.h"
+#include <pytalloc.h>
 
 /* A Python C API module to use LIBGPO */
 
@@ -498,6 +499,7 @@ static PyMethodDef ADS_methods[] = {
 static PyTypeObject ads_ADSType = {
        .tp_name = "gpo.ADS_STRUCT",
        .tp_basicsize = sizeof(ADS),
+       .tp_new = PyType_GenericNew,
        .tp_dealloc = (destructor)py_ads_dealloc,
        .tp_flags = Py_TPFLAGS_DEFAULT,
        .tp_doc = "ADS struct",
@@ -540,8 +542,7 @@ MODULE_INIT_FUNC(gpo)
                goto err;
        }
 
-       ads_ADSType.tp_new = PyType_GenericNew;
-       if (PyType_Ready(&ads_ADSType) < 0) {
+       if (pytalloc_BaseObject_PyType_Ready(&ads_ADSType) < 0) {
                goto err;
        }