static void wolfSSH_SFTP_RecvSetSend(WOLFSSH* ssh, byte* buf, int sz)
{
    WS_SFTP_RECV_STATE* state = NULL;

    if (ssh == NULL || sz < 0 || buf == NULL) {
        return;
    }

    state = ssh->recvState;
    if (state == NULL) {
        return;
    }

    /* free up existing data if needed */
    if (buf != state->buffer.data && state->buffer.data != NULL) {
        WFREE(state->buffer.data, ssh->ctx->heap, DYNTYPE_BUFFER);
        state->buffer.data = NULL;
    }

    /* take over control of buffer */
    state->buffer.data = buf;
    state->buffer.sz   = sz;
    state->toSend = 1;
}
static void wolfSSH_SFTP_RecvSetSend(WOLFSSH* ssh, byte* buf, int sz)
{
    WS_SFTP_RECV_STATE* state = NULL;

    if (ssh == NULL || sz < 0 || buf == NULL) {
        return;
    }

    state = ssh->recvState;
    if (state == NULL) {
        return;
    }

     
    if (buf != state->buffer.data && state->buffer.data != NULL) {
        WFREE(state->buffer.data, ssh->ctx->heap, DYNTYPE_BUFFER);
        state->buffer.data = NULL;
    }

     
    state->buffer.data = buf;
    state->buffer.sz   = sz;
    state->toSend = 1;
}