mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-09 23:33:46 -05:00
xfer_{up,down}load_gotpkt free their input sftp_packet as a side
effect of handling it, but they do not free it if it isn't a packet they recognise as part of their upload/download. Invent a return value that specifically signals this, and consistently free pktin at every call site if that return value comes back. Also, ensure that that return value also always comes with something meaningful in fxp_error. [originally from svn r9915]
This commit is contained in:
8
pscp.c
8
pscp.c
@ -928,6 +928,8 @@ int scp_send_filedata(char *data, int len)
|
||||
ret = xfer_upload_gotpkt(scp_sftp_xfer, pktin);
|
||||
if (ret <= 0) {
|
||||
tell_user(stderr, "error while writing: %s", fxp_error());
|
||||
if (ret == INT_MIN) /* pktin not even freed */
|
||||
sfree(pktin);
|
||||
errs++;
|
||||
return 1;
|
||||
}
|
||||
@ -969,6 +971,8 @@ int scp_send_finish(void)
|
||||
ret = xfer_upload_gotpkt(scp_sftp_xfer, pktin);
|
||||
if (ret <= 0) {
|
||||
tell_user(stderr, "error while writing: %s", fxp_error());
|
||||
if (ret == INT_MIN) /* pktin not even freed */
|
||||
sfree(pktin);
|
||||
errs++;
|
||||
return 1;
|
||||
}
|
||||
@ -1566,6 +1570,8 @@ int scp_recv_filedata(char *data, int len)
|
||||
ret = xfer_download_gotpkt(scp_sftp_xfer, pktin);
|
||||
if (ret <= 0) {
|
||||
tell_user(stderr, "pscp: error while reading: %s", fxp_error());
|
||||
if (ret == INT_MIN) /* pktin not even freed */
|
||||
sfree(pktin);
|
||||
errs++;
|
||||
return -1;
|
||||
}
|
||||
@ -1611,6 +1617,8 @@ int scp_finish_filerecv(void)
|
||||
ret = xfer_download_gotpkt(scp_sftp_xfer, pktin);
|
||||
if (ret <= 0) {
|
||||
tell_user(stderr, "pscp: error while reading: %s", fxp_error());
|
||||
if (ret == INT_MIN) /* pktin not even freed */
|
||||
sfree(pktin);
|
||||
errs++;
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user