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
Этот коммит содержится в:
родитель
cfd883196d
Коммит
094aeeafbe
@ -814,6 +814,7 @@ int main(int argc, char **argv) {
|
|||||||
sshbind = ssh_bind_new();
|
sshbind = ssh_bind_new();
|
||||||
if (sshbind == NULL) {
|
if (sshbind == NULL) {
|
||||||
fprintf(stderr, "ssh_bind_new failed\n");
|
fprintf(stderr, "ssh_bind_new failed\n");
|
||||||
|
ssh_finalize();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -829,6 +830,8 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if(ssh_bind_listen(sshbind) < 0) {
|
if(ssh_bind_listen(sshbind) < 0) {
|
||||||
fprintf(stderr, "%s\n", ssh_get_error(sshbind));
|
fprintf(stderr, "%s\n", ssh_get_error(sshbind));
|
||||||
|
ssh_bind_free(sshbind);
|
||||||
|
ssh_finalize();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user