rem: req->reply_type = type;
context: static void *process_requests(void *_data){    (void) _data;    while (1) {        int res;        struct buffer buf;        uint8_t type;        struct request *req;        uint32_t id;        buf_init(&buf, 0);        res = sftp_read(&type, &buf);        if (res == -1)            break;        if (buf_get_uint32(&buf, &id) == -1)            break;        pthread_mutex_lock(&lock);        req = (struct request *) g_hash_table_lookup(reqtab, (gpointer) id);        if (req == NULL)            fprintf(stderr, "request %i not found\n", id);        else            g_hash_table_remove(reqtab, (gpointer) id);        pthread_mutex_unlock(&lock);        if (req != NULL) {            struct timeval now;            unsigned int difftime;            gettimeofday(&now, NULL);            difftime = (now.tv_sec - req->start.tv_sec) * 1000;            difftime += (now.tv_usec - req->start.tv_usec) / 1000;            DEBUG("  [%05i] %14s %8ibytes (%ims)\n", id, type_name(type),                  buf.size+5, difftime);            req->reply = buf;            if (req->want_reply) {                req->reply_type = type;                sem_post(&req->ready);            } else {                buf_free(&req->reply);                sem_destroy(&req->ready);                free(req);            }        } else            buf_free(&buf);    }    kill(getpid(), SIGTERM);    return NULL;}