mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +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:
parent
10019f7cdf
commit
94bf6e69db
@ -4248,18 +4248,21 @@ static int control_restoredb(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
|
|||||||
nodemap = get_nodemap(ctdb, false);
|
nodemap = get_nodemap(ctdb, false);
|
||||||
if (nodemap == NULL) {
|
if (nodemap == NULL) {
|
||||||
fprintf(stderr, "Failed to get nodemap\n");
|
fprintf(stderr, "Failed to get nodemap\n");
|
||||||
|
close(fd);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = get_generation(mem_ctx, ctdb, &generation);
|
ret = get_generation(mem_ctx, ctdb, &generation);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
fprintf(stderr, "Failed to get current generation\n");
|
fprintf(stderr, "Failed to get current generation\n");
|
||||||
|
close(fd);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = list_of_active_nodes(nodemap, CTDB_UNKNOWN_PNN, mem_ctx,
|
count = list_of_active_nodes(nodemap, CTDB_UNKNOWN_PNN, mem_ctx,
|
||||||
&pnn_list);
|
&pnn_list);
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
|
close(fd);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4390,6 +4393,7 @@ static int control_restoredb(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
close(fd);
|
||||||
ctdb_ctrl_set_recmode(mem_ctx, ctdb->ev, ctdb->client,
|
ctdb_ctrl_set_recmode(mem_ctx, ctdb->ev, ctdb->client,
|
||||||
ctdb->pnn, TIMEOUT(), CTDB_RECOVERY_ACTIVE);
|
ctdb->pnn, TIMEOUT(), CTDB_RECOVERY_ACTIVE);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user