summaryrefslogtreecommitdiffstats
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-07-09 13:51:06 +0000
committerStefan Metzmacher <metze@samba.org>2014-07-22 15:32:39 +0200
commitff53cde795f160e0ee86ad17f09750c2ee2085f1 (patch)
tree2eb4385f1f77c754adaf541ec5868888f856d943 /source3/lib
parenta017280ca554a534d9422a055b1cfc0baa3eb8c6 (diff)
downloadsamba-ff53cde795f160e0ee86ad17f09750c2ee2085f1.tar.gz
samba-ff53cde795f160e0ee86ad17f09750c2ee2085f1.tar.xz
samba-ff53cde795f160e0ee86ad17f09750c2ee2085f1.zip
lib: Fix a valgrind error
See the comment inside Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/background.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source3/lib/background.c b/source3/lib/background.c
index a9fd04f6a4..869f2ef475 100644
--- a/source3/lib/background.c
+++ b/source3/lib/background.c
@@ -181,7 +181,18 @@ static void background_job_waited(struct tevent_req *subreq)
if (written == -1) {
_exit(1);
}
- TALLOC_FREE(state->msg);
+
+ /*
+ * No TALLOC_FREE here, messaging_parent_dgm_cleanup_init for
+ * example calls background_job_send with "messaging_context"
+ * as talloc parent. Thus "state" will be freed with the
+ * following talloc_free will have removed "state" when it
+ * returns. TALLOC_FREE will then write a NULL into free'ed
+ * memory. talloc_free() is required although we immediately
+ * exit, the messaging_context's destructor will want to clean
+ * up.
+ */
+ talloc_free(state->msg);
_exit(0);
}