diff --git a/src/sbbs3/sftp.cpp b/src/sbbs3/sftp.cpp index 76ea7178e6a083d0bcacc5a78f92fc02bd5edebc..b6cb0b7bae6cf2f122df040be3f2df1dacdddb99 100644 --- a/src/sbbs3/sftp.cpp +++ b/src/sbbs3/sftp.cpp @@ -1589,7 +1589,9 @@ sftp_opendir(sftp_str_t path, void *cb_data) if (h == nullptr) { return sftps_send_error(sbbs->sftp_state, SSH_FX_FAILURE, "Handle allocation failure"); } - return sftps_send_handle(sbbs->sftp_state, h); + bool ret = sftps_send_handle(sbbs->sftp_state, h); + free_sftp_str(h); + return ret; } // TODO: This is still too ugly... should be split into multiple functions.