diff options
author | Xiang Xiao <xiaoxiang@xiaomi.com> | 2021-05-06 23:29:50 -0700 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2021-05-27 13:45:47 +0200 |
commit | 094aeeafbe8f3154d3721ddbd71477c57f4c487b (patch) | |
tree | 779578d01ed16876b5d44b37fc17fca8963d564f | |
parent | cfd883196d5187ef033848204de068c7dca356e3 (diff) | |
download | libssh-094aeeafbe8f3154d3721ddbd71477c57f4c487b.tar.gz libssh-094aeeafbe8f3154d3721ddbd71477c57f4c487b.tar.xz libssh-094aeeafbe8f3154d3721ddbd71477c57f4c487b.zip |
examples/ssh_server: Free the resource in the failure path
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I60f64b9eda3ba233a825b2c4fe19d5bf7eaf2fa3
-rw-r--r-- | examples/ssh_server_fork.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; } |