From 094aeeafbe8f3154d3721ddbd71477c57f4c487b Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 6 May 2021 23:29:50 -0700 Subject: [PATCH] examples/ssh_server: Free the resource in the failure path Signed-off-by: Xiang Xiao Reviewed-by: Jakub Jelen Change-Id: I60f64b9eda3ba233a825b2c4fe19d5bf7eaf2fa3 --- examples/ssh_server_fork.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/ssh_server_fork.c b/examples/ssh_server_fork.c index 5a94c139..7f939d21 100644 --- a/examples/ssh_server_fork.c +++ b/examples/ssh_server_fork.c @@ -814,6 +814,7 @@ int main(int argc, char **argv) { sshbind = ssh_bind_new(); if (sshbind == NULL) { fprintf(stderr, "ssh_bind_new failed\n"); + ssh_finalize(); return 1; } @@ -829,6 +830,8 @@ int main(int argc, char **argv) { if(ssh_bind_listen(sshbind) < 0) { fprintf(stderr, "%s\n", ssh_get_error(sshbind)); + ssh_bind_free(sshbind); + ssh_finalize(); return 1; }