Skip to content

Commit

Permalink
client session BUGFIX check all errors when creating RPCs
Browse files Browse the repository at this point in the history
Fixes #283
  • Loading branch information
michalvasko committed Jan 13, 2021
1 parent 623d59e commit 283c3c0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/session_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2654,20 +2654,32 @@ nc_send_rpc(struct nc_session *session, struct nc_rpc *rpc, int timeout, uint64_

data = lyd_new(NULL, mod, "kill-session");
sprintf(str, "%u", rpc_k->sid);
lyd_new_leaf(data, mod, "session-id", str);
node = lyd_new_leaf(data, mod, "session-id", str);
if (!node) {
lyd_free(data);
return NC_MSG_ERROR;
}
break;

case NC_RPC_COMMIT:
rpc_com = (struct nc_rpc_commit *)rpc;

data = lyd_new(NULL, mod, "commit");
if (rpc_com->confirmed) {
lyd_new_leaf(data, mod, "confirmed", NULL);
node = lyd_new_leaf(data, mod, "confirmed", NULL);
if (!node) {
lyd_free(data);
return NC_MSG_ERROR;
}
}

if (rpc_com->confirm_timeout) {
sprintf(str, "%u", rpc_com->confirm_timeout);
lyd_new_leaf(data, mod, "confirm-timeout", str);
node = lyd_new_leaf(data, mod, "confirm-timeout", str);
if (!node) {
lyd_free(data);
return NC_MSG_ERROR;
}
}

if (rpc_com->persist) {
Expand Down

0 comments on commit 283c3c0

Please sign in to comment.