This is the patch for finalize backen of tevent

Galen(liugang) galen.gang.liu at gmail.com
Sun Dec 30 23:52:40 MST 2012


As tevent_backend_init allocate some memory and there isn't other place to
free it, so add a talloc_set_destructor on it.

--- tevent-0.9.17.orig/tevent.c    2012-08-17 22:39:01.000000000 +0800
+++ tevent-0.9.17/tevent.c    2012-12-31 14:45:11.539407205 +0800
@@ -122,6 +122,25 @@
 }

 /*
+  finalize backends
+*/
+static int tevent_backend_finalize(TALLOC_CTX *mem_ctx)
+{
+    struct tevent_ops_list *e, *en;
+
+    for (e = tevent_backends; e; e = en) {
+        en = e->next;
+        talloc_free(e);
+    }
+
+    if (tevent_default_backend) {
+        TALLOC_FREE(tevent_default_backend);
+    }
+
+    return 0;
+}
+
+/*
   list available backends
 */
 const char **tevent_backend_list(TALLOC_CTX *mem_ctx)
@@ -246,6 +265,7 @@
     struct tevent_ops_list *e;

     tevent_backend_init();
+    talloc_set_destructor(mem_ctx, tevent_backend_finalize);

     if (name == NULL) {
         name = tevent_default_backend;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tevent_finalize_backend.patch
Type: application/octet-stream
Size: 742 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20121231/9574d9f3/attachment.obj>


More information about the samba-technical mailing list