mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-09-01 06:21:56 +03:00
examples: Avoid memory leak from sftp
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Norbert Pocs <npocs@redhat.com>
(cherry picked from commit 8c1b159a3a
)
This commit is contained in:
committed by
Andreas Schneider
parent
d190053660
commit
512ac7620b
@@ -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");
|
||||
|
||||
|
Reference in New Issue
Block a user