Skip to content

Commit

Permalink
tirpc_clnt_destroy: Determine the return value of clnt_create()
Browse files Browse the repository at this point in the history
Determine the return value of clnt_create() to avoid segmentation fault
when executing clnt_destroy() when the return value of create is NULL.

Link: https://lore.kernel.org/ltp/[email protected]/
Reviewed-by: Chuck Lever <[email protected]>
Tested-by: Chen Hanxiao <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
Signed-off-by: Ma Xinjian <[email protected]>
  • Loading branch information
MaXinjian authored and pevik committed Oct 21, 2024
1 parent 585e435 commit 4aa4309
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ int main(int argn, char *argc[])
//first create client
clnt = clnt_create(argc[1], progNum, VERSNUM, nettype);

if (clnt == NULL) {
clnt_pcreateerror("err");
printf("%d\n", rpc_createerr.cf_stat);

return 1;
}

//then call destroy macro
clnt_destroy(clnt);

Expand Down

0 comments on commit 4aa4309

Please sign in to comment.