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:
Jakub Jelen
2023-06-01 11:55:28 +02:00
parent af771cc35f
commit 6bebac10b7

View File

@@ -1917,12 +1917,14 @@ sftp_file sftp_open(sftp_session sftp,
ssh_set_error(sftp->session,
SSH_FATAL,
"Cannot open in append mode. Unknown file size.");
sftp_attributes_free(stat_data);
sftp_close(handle);
sftp_set_error(sftp, SSH_FX_FAILURE);
return NULL;
}
handle->offset = stat_data->size;
sftp_attributes_free(stat_data);
}
return handle;
default: