diff options
author | Amitay Isaacs <amitay@gmail.com> | 2013-04-02 12:08:39 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-04-05 12:59:25 +1100 |
commit | 96ad89f438827b994ed841aca8a78bef4227da48 (patch) | |
tree | 6740b2c89bfb859c6c967faf90f1660303431e4d /ctdb/common/ctdb_message.c | |
parent | d2ed7429b7e5c1366af49f9fff35c4cf207b84af (diff) | |
download | samba-96ad89f438827b994ed841aca8a78bef4227da48.tar.gz samba-96ad89f438827b994ed841aca8a78bef4227da48.tar.xz samba-96ad89f438827b994ed841aca8a78bef4227da48.zip |
common/messaging: Free message list header if all message handlers are freed
This makes sure that even if the srvids are not deregistered, the header
structure is freed when the last message handler has been freed as a result of
client going away.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit 4e1ec7412866f2d31c41de1bec0fbf788c03051b)
Diffstat (limited to 'ctdb/common/ctdb_message.c')
-rw-r--r-- | ctdb/common/ctdb_message.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ctdb/common/ctdb_message.c b/ctdb/common/ctdb_message.c index 50d21890f8f..2152c88dc9a 100644 --- a/ctdb/common/ctdb_message.c +++ b/ctdb/common/ctdb_message.c @@ -176,6 +176,9 @@ static int message_handler_destructor(struct ctdb_message_list *m) struct ctdb_message_list_header *h = m->h; DLIST_REMOVE(h->m, m); + if (h->m == NULL) { + talloc_free(h); + } return 0; } @@ -255,9 +258,6 @@ int ctdb_deregister_message_handler(struct ctdb_context *ctdb, uint64_t srvid, v for (m=h->m; m; m=m->next) { if (m->message_private == private_data) { talloc_free(m); - if (h->m == NULL) { - talloc_free(h); - } return 0; } } |