1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ctdb-tools: Fix CID 1364703 - resource leak

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12121

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Amitay Isaacs 2016-08-04 15:50:38 +10:00 committed by Martin Schwenke
parent 10019f7cdf
commit 94bf6e69db

View File

@ -4248,18 +4248,21 @@ static int control_restoredb(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
nodemap = get_nodemap(ctdb, false);
if (nodemap == NULL) {
fprintf(stderr, "Failed to get nodemap\n");
close(fd);
return ENOMEM;
}
ret = get_generation(mem_ctx, ctdb, &generation);
if (ret != 0) {
fprintf(stderr, "Failed to get current generation\n");
close(fd);
return ret;
}
count = list_of_active_nodes(nodemap, CTDB_UNKNOWN_PNN, mem_ctx,
&pnn_list);
if (count <= 0) {
close(fd);
return ENOMEM;
}
@ -4390,6 +4393,7 @@ static int control_restoredb(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
failed:
close(fd);
ctdb_ctrl_set_recmode(mem_ctx, ctdb->ev, ctdb->client,
ctdb->pnn, TIMEOUT(), CTDB_RECOVERY_ACTIVE);
return ret;