mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 18:04:25 +09:00
sftp: Avoid leaking sftp attributes when opening file
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
This commit is contained in:
@@ -1917,12 +1917,14 @@ sftp_file sftp_open(sftp_session sftp,
|
|||||||
ssh_set_error(sftp->session,
|
ssh_set_error(sftp->session,
|
||||||
SSH_FATAL,
|
SSH_FATAL,
|
||||||
"Cannot open in append mode. Unknown file size.");
|
"Cannot open in append mode. Unknown file size.");
|
||||||
|
sftp_attributes_free(stat_data);
|
||||||
sftp_close(handle);
|
sftp_close(handle);
|
||||||
sftp_set_error(sftp, SSH_FX_FAILURE);
|
sftp_set_error(sftp, SSH_FX_FAILURE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->offset = stat_data->size;
|
handle->offset = stat_data->size;
|
||||||
|
sftp_attributes_free(stat_data);
|
||||||
}
|
}
|
||||||
return handle;
|
return handle;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user