]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-daemon: Avoid memory leak
authorAmitay Isaacs <amitay@gmail.com>
Tue, 5 Apr 2016 07:11:17 +0000 (17:11 +1000)
committerMartin Schwenke <martins@samba.org>
Sat, 23 Apr 2016 21:55:14 +0000 (23:55 +0200)
ctdb->idr and ctdb->srv get initialized as part of ctdb_init() called
from ctdb_cmdline_init().

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/server/ctdb_daemon.c
ctdb/server/ctdbd.c

index 9a3369166db55590780c4a918950061324a338c6..a5fefe33f0a4c19e47463ad68461a162aebc3549 100644 (file)
@@ -1276,6 +1276,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
 
        ctdb_set_child_logging(ctdb);
 
+       TALLOC_FREE(ctdb->srv);
        if (srvid_init(ctdb, &ctdb->srv) != 0) {
                DEBUG(DEBUG_CRIT,("Failed to setup message srvid context\n"));
                exit(1);
index 6d8a7d4becad66186803d5c029343bb8bb5c3ce5..5fc1db6318d99d9df1a6d99c7616c3b5d93e2528 100644 (file)
@@ -197,6 +197,7 @@ int main(int argc, const char *argv[])
        ctdb->upcalls          = &ctdb_upcalls;
        ctdb->recovery_lock_fd = -1;
 
+       TALLOC_FREE(ctdb->idr);
        ret = reqid_init(ctdb, 0, &ctdb->idr);;
        if (ret != 0) {
                DEBUG(DEBUG_ALERT, ("reqid_init failed (%s)\n", strerror(ret)));