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

examples: Use SSH_STRING_FREE_CHAR()

Fixes T183

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Andreas Schneider
2019-11-05 13:14:12 +01:00
parent 4e809ef122
commit 0938d397be
2 changed files with 9 additions and 9 deletions

View File

@ -234,7 +234,7 @@ int authenticate_console(ssh_session session)
banner = ssh_get_issue_banner(session); banner = ssh_get_issue_banner(session);
if (banner) { if (banner) {
printf("%s\n",banner); printf("%s\n",banner);
ssh_string_free_char(banner); SSH_STRING_FREE_CHAR(banner);
} }
return rc; return rc;

View File

@ -303,7 +303,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive) {
fprintf(stderr, fprintf(stderr,
"Error: %s\n", "Error: %s\n",
ssh_get_error(src->session)); ssh_get_error(src->session));
ssh_string_free_char(filename); SSH_STRING_FREE_CHAR(filename);
return -1; return -1;
} }
} while(r != SSH_SCP_REQUEST_NEWFILE); } while(r != SSH_SCP_REQUEST_NEWFILE);
@ -316,7 +316,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive) {
fprintf(stderr, fprintf(stderr,
"error: %s\n", "error: %s\n",
ssh_get_error(dest->session)); ssh_get_error(dest->session));
ssh_string_free_char(filename); SSH_STRING_FREE_CHAR(filename);
ssh_scp_free(dest->scp); ssh_scp_free(dest->scp);
dest->scp = NULL; dest->scp = NULL;
return -1; return -1;
@ -331,7 +331,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive) {
if (src->is_ssh) { if (src->is_ssh) {
ssh_scp_deny_request(src->scp, "Cannot open local file"); ssh_scp_deny_request(src->scp, "Cannot open local file");
} }
ssh_string_free_char(filename); SSH_STRING_FREE_CHAR(filename);
return -1; return -1;
} }
} }
@ -347,7 +347,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive) {
fprintf(stderr, fprintf(stderr,
"Error reading scp: %s\n", "Error reading scp: %s\n",
ssh_get_error(src->session)); ssh_get_error(src->session));
ssh_string_free_char(filename); SSH_STRING_FREE_CHAR(filename);
return -1; return -1;
} }
@ -364,7 +364,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive) {
fprintf(stderr, fprintf(stderr,
"Error reading file: %s\n", "Error reading file: %s\n",
strerror(errno)); strerror(errno));
ssh_string_free_char(filename); SSH_STRING_FREE_CHAR(filename);
return -1; return -1;
} }
} }
@ -377,7 +377,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive) {
ssh_get_error(dest->session)); ssh_get_error(dest->session));
ssh_scp_free(dest->scp); ssh_scp_free(dest->scp);
dest->scp = NULL; dest->scp = NULL;
ssh_string_free_char(filename); SSH_STRING_FREE_CHAR(filename);
return -1; return -1;
} }
} else { } else {
@ -386,7 +386,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive) {
fprintf(stderr, fprintf(stderr,
"Error writing in local file: %s\n", "Error writing in local file: %s\n",
strerror(errno)); strerror(errno));
ssh_string_free_char(filename); SSH_STRING_FREE_CHAR(filename);
return -1; return -1;
} }
} }
@ -394,7 +394,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive) {
} while(total < size); } while(total < size);
ssh_string_free_char(filename); SSH_STRING_FREE_CHAR(filename);
printf("wrote %zu bytes\n", total); printf("wrote %zu bytes\n", total);
return 0; return 0;
} }