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);
if (banner) {
printf("%s\n",banner);
ssh_string_free_char(banner);
SSH_STRING_FREE_CHAR(banner);
}
return rc;

View File

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