s4: COM: Remove talloc_autofree_context() from (unused) COM code.
authorJeremy Allison <jra@samba.org>
Mon, 24 Jul 2017 19:00:21 +0000 (12:00 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 26 Jul 2017 19:35:21 +0000 (21:35 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
source4/lib/com/classes/simple.c
source4/lib/com/com.h
source4/lib/com/dcom/tables.c
source4/lib/com/tables.c
source4/lib/wmi/wbemdata.c

index 27e1e5d4243c323784fccfeac83224db23e01b2c..35e6e3f0d1969210e6f3f2275eb3c1968cd456fa 100644 (file)
@@ -44,9 +44,9 @@ sub ParseRegFunc($)
 {
        my $interface = shift;
 
-       $res .= "static NTSTATUS dcom_proxy_$interface->{NAME}_init(void)
+       $res .= "static NTSTATUS dcom_proxy_$interface->{NAME}_init(TALLOC_CTX *ctx)
 {
-       struct $interface->{NAME}_vtable *proxy_vtable = talloc(talloc_autofree_context(), struct $interface->{NAME}_vtable);
+       struct $interface->{NAME}_vtable *proxy_vtable = talloc(ctx, struct $interface->{NAME}_vtable);
 ";
 
        if (defined($interface->{BASE})) {
@@ -75,7 +75,7 @@ sub ParseRegFunc($)
        $res.= "
        proxy_vtable->iid = ndr_table_$interface->{NAME}.syntax_id.uuid;
 
-       return dcom_register_proxy((struct IUnknown_vtable *)proxy_vtable);
+       return dcom_register_proxy(ctx, (struct IUnknown_vtable *)proxy_vtable);
 }\n\n";
 }
 
index 28f5d848de5b66593fc69e4b5d09582f6ea9a61d..7d0573372e338e5944b255796c9797f65593ddfd 100644 (file)
@@ -110,7 +110,7 @@ static struct IStream_vtable simple_IStream_vtable = {
 NTSTATUS com_simple_init(TALLOC_CTX *ctx)
 {
        struct GUID clsid;
-       struct IUnknown *class_object = talloc(talloc_autofree_context(), struct IUnknown);
+       struct IUnknown *class_object = talloc(ctx, struct IUnknown);
 
        class_object->ctx = NULL;
        class_object->object_data = NULL;
@@ -120,5 +120,5 @@ NTSTATUS com_simple_init(TALLOC_CTX *ctx)
        GUID_from_string(COM_ICLASSFACTORY_UUID, &simple_classobject_vtable.iid);
        GUID_from_string(COM_ISTREAM_UUID, &simple_IStream_vtable.iid);
 
-       return com_register_running_class(&clsid, PROGID_SIMPLE, class_object);
+       return com_register_running_class(ctx, &clsid, PROGID_SIMPLE, class_object);
 }
index 82d10daf4fd8a1a8de66c78183a254265ec0ac80..e6be31146783b5a9969fea7d57bad5982170bef5 100644 (file)
@@ -21,6 +21,7 @@
 #define __SAMBA_COM_H__
 
 #include "librpc/gen_ndr/misc.h"
+#include "lib/talloc/talloc.h"
 
 struct com_context;
 struct tevent_context;
@@ -38,7 +39,7 @@ struct com_context
 };
 
 struct IUnknown *com_class_by_clsid(struct com_context *ctx, const struct GUID *clsid);
-NTSTATUS com_register_running_class(struct GUID *clsid, const char *progid, struct IUnknown *p);
+NTSTATUS com_register_running_class(TALLOC_CTX *ctx, struct GUID *clsid, const char *progid, struct IUnknown *p);
 
 struct dcom_interface_p *dcom_get_local_iface_p(struct GUID *ipid);
 
index f94aa879253e68c0eba04644481c81840652e3de..7f745c1d479f23d9695f2e54f83dc37bdb078e8d 100644 (file)
@@ -29,9 +29,10 @@ static struct dcom_proxy {
        struct dcom_proxy *prev, *next;
 }  *proxies = NULL;
 
-NTSTATUS dcom_register_proxy(struct IUnknown_vtable *proxy_vtable)
+NTSTATUS dcom_register_proxy(TALLOC_CTX *ctx,
+               struct IUnknown_vtable *proxy_vtable)
 {
-       struct dcom_proxy *proxy = talloc(talloc_autofree_context(), struct dcom_proxy);
+       struct dcom_proxy *proxy = talloc(ctx, struct dcom_proxy);
 
        proxy->vtable = proxy_vtable;
        DLIST_ADD(proxies, proxy);
@@ -57,9 +58,10 @@ static struct dcom_marshal {
        struct dcom_marshal *prev, *next;
 }  *marshals = NULL;
 
-NTSTATUS dcom_register_marshal(struct GUID *clsid, marshal_fn marshal, unmarshal_fn unmarshal)
+NTSTATUS dcom_register_marshal(TALLOC_CTX *ctx,
+               struct GUID *clsid, marshal_fn marshal, unmarshal_fn unmarshal)
 {
-       struct dcom_marshal *p = talloc(talloc_autofree_context(), struct dcom_marshal);
+       struct dcom_marshal *p = talloc(ctx, struct dcom_marshal);
 
        p->clsid = *clsid;
        p->marshal = marshal;
index 842067e8a54b65a7998960310dc952e24d3d417e..e1f93bcae59aa34fe8b0d62f02ea2d7a73d34cc1 100644 (file)
@@ -96,9 +96,11 @@ struct IUnknown *com_class_by_clsid(struct com_context *ctx, const struct GUID *
        return NULL;
 }
 
-NTSTATUS com_register_running_class(struct GUID *clsid, const char *progid, struct IUnknown *p)
+NTSTATUS com_register_running_class(TALLOC_CTX *ctx,
+               struct GUID *clsid, const char *progid, struct IUnknown *p)
 {
-       struct com_class *l = talloc_zero(running_classes?running_classes:talloc_autofree_context(), struct com_class);
+       struct com_class *l = talloc_zero(running_classes?
+                               running_classes : ctx, struct com_class);
 
        l->clsid = *clsid;
        l->progid = talloc_strdup(l, progid);
index 2aeda01a50e5932dd3f4f89308b9621e61769ff8..df98da43a2a4cd5d99a6666d14dc975bc40f486e 100644 (file)
@@ -432,11 +432,11 @@ struct composite_context *dcom_proxy_IEnumWbemClassObject_Release_send(struct IU
        return c;
 }
 
-NTSTATUS dcom_proxy_IWbemClassObject_init(void)
+NTSTATUS dcom_proxy_IWbemClassObject_init(TALLOC_CTX *ctx)
 {
        struct GUID clsid;
        GUID_from_string("4590f812-1d3a-11d0-891f-00aa004b2e24", &clsid);
-       dcom_register_marshal(&clsid, marshal, unmarshal);
+       dcom_register_marshal(ctx, &clsid, marshal, unmarshal);
 
 #if 0
        struct IEnumWbemClassObject_vtable *proxy_vtable;