From 979693069a681deee7a1b0aa540adc46b0eec80d Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 5 Apr 2016 17:11:17 +1000 Subject: [PATCH] ctdb-daemon: Avoid memory leak ctdb->idr and ctdb->srv get initialized as part of ctdb_init() called from ctdb_cmdline_init(). Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- ctdb/server/ctdb_daemon.c | 1 + ctdb/server/ctdbd.c | 1 + 2 files changed, 2 insertions(+) diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 9a3369166db..a5fefe33f0a 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -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); diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index 6d8a7d4beca..5fc1db6318d 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -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)));