1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-29 13:01:13 +03:00

examples: Avoid memory leak from sftp

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Norbert Pocs <npocs@redhat.com>
This commit is contained in:
Jakub Jelen
2022-12-12 14:57:56 +01:00
parent 96ad1b380d
commit 8c1b159a3a

View File

@ -47,7 +47,7 @@ static void do_sftp(ssh_session session) {
int len = 1;
unsigned int i;
char data[BUF_SIZE] = {0};
char *lnk;
char *lnk = NULL;
unsigned int count;
@ -86,6 +86,7 @@ static void do_sftp(ssh_session session) {
goto end;
}
printf("readlink /tmp/sftp_symlink_test: %s\n", lnk);
ssh_string_free_char(lnk);
sftp_unlink(sftp, "/tmp/sftp_symlink_test");