diff options
author | Amitay Isaacs <amitay@gmail.com> | 2014-10-14 17:52:55 +1100 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2014-10-17 12:56:02 +0200 |
commit | 470af881479d1a1588dc23ef40622b4d8f006b61 (patch) | |
tree | fb9a402e3b403d3ab3533814b89fcd4333c03b8d /ctdb/tools | |
parent | 71cb5749f4d7a542a1dccb250f91c58fd2bbf54c (diff) | |
download | samba-470af881479d1a1588dc23ef40622b4d8f006b61.tar.gz |
ctdb-tools: Fix heap-use-after-free problem
Found by address sanitizer.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Oct 17 12:56:02 CEST 2014 on sn-devel-104
Diffstat (limited to 'ctdb/tools')
-rw-r--r-- | ctdb/tools/ctdb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 71dfc28779f..c34e33d1e56 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -896,6 +896,7 @@ static int find_node_xpnn(void) TALLOC_CTX *mem_ctx = talloc_new(NULL); struct pnn_node *pnn_nodes; struct pnn_node *pnn_node; + int pnn; pnn_nodes = read_nodes_file(mem_ctx); if (pnn_nodes == NULL) { @@ -906,8 +907,9 @@ static int find_node_xpnn(void) for(pnn_node=pnn_nodes;pnn_node;pnn_node=pnn_node->next) { if (ctdb_sys_have_ip(&pnn_node->addr)) { + pnn = pnn_node->pnn; talloc_free(mem_ctx); - return pnn_node->pnn; + return pnn; } } @@ -1818,6 +1820,7 @@ find_other_host_for_public_ip(struct ctdb_context *ctdb, ctdb_sock_addr *addr) struct ctdb_all_public_ips *ips; struct ctdb_node_map *nodemap=NULL; int i, j, ret; + int pnn; ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, tmp_ctx, &nodemap); if (ret != 0) { @@ -1843,8 +1846,9 @@ find_other_host_for_public_ip(struct ctdb_context *ctdb, ctdb_sock_addr *addr) for (j=0;j<ips->num;j++) { if (ctdb_same_ip(addr, &ips->ips[j].addr)) { + pnn = nodemap->nodes[i].pnn; talloc_free(tmp_ctx); - return nodemap->nodes[i].pnn; + return pnn; } } talloc_free(ips); |