zeromq / zwssock

ZeroMQ WebSocket library for CZMQ
Mozilla Public License 2.0
88 stars 35 forks source link

Possible memory leak? #8

Closed skinkie closed 7 years ago

skinkie commented 7 years ago

I am reviewing the example. Shouldn't there be a zmsg_destroy(&msg); after line 55?

https://github.com/zeromq/zwssock/blob/master/src/CZMQ-ZWSSock/main.c#L55

bluca commented 7 years ago

the send function will destroy the message on successful send - perhaps the example could be updated to take action on error, would you send a PR to implement this?

skinkie commented 7 years ago

Which will always be the case at this moment ;) do you want me to change this as well?

int zwssock_send(zwssock_t *self, zmsg_t **msg_p)
{
    assert(self);
    assert(zmsg_size(*msg_p) > 0);
    zmsg_send(msg_p, self->data);
    return 0;
}
bluca commented 7 years ago

sounds good

skinkie commented 7 years ago

@bluca can you give me the exact line in the libzmq that does what you say with respect to destroying the message after a succesfull send?

somdoron commented 7 years ago

https://github.com/zeromq/czmq/blob/master/src/zmsg.c#L150

skinkie commented 7 years ago

That explains :-) Was looking in the wrong library.