News for hackers. Stuff that matters.
Re:Show HN: Chan – pure C implementation of Go channels by clarry on Saturday August 30, 2014 @06:28AM (#8246076)
You shouldn't allocate heap space for a pointer in blocking_pipe_read. Also, it looks like you're leaking it in the else branch.

Just allocate a pointer on the stack, read into it, and then assign the value into the provided space:

    void *msg_ptr;
    read(..., &msg_ptr, sizeof msg_ptr);
    *data = msg_ptr;

There are no comments on this comment yet.