[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users]



Hi,

I am a new user of libevent - I ran into the following valgrind error
on my machine:

Version: libevent-2.0.8-rc
OS: Ubuntu 10.04 LTS amd64

Of interest is (bufferevent_sock.c:321) inside:
struct bufferevent *bufferevent_socket_new()

struct bufferevent_private *bufev_p;
// ...
if ((bufev_p = mm_calloc(1, sizeof(struct bufferevent_private)))== NULL)
// ...
// ----------------------------------------

bufev_p doesn't seem to get freed with mm_free() unless there is an error.

My question is, what to do about this valgrind error?

1. There is no bug - suppress the valgrind message?
2. There is a flaw in the way I am calling bufferevent_socket_new().
In other words, I am not calling bufferevent_free() at the right time?
3. This code needs to be patched?
4. Something else?

Please advise.  Thank you.

- Ken

==2933== 2,728 (496 direct, 2,232 indirect) bytes in 1 blocks are
definitely lost in loss record 9 of 9
==2933==    at 0x4C278FC: calloc (vg_replace_malloc.c:467)
==2933==    by 0x5781B55: bufferevent_socket_new (bufferevent_sock.c:321)
==2933==    by 0x4CE3A5: accept_conn_cb(evconnlistener*, int,
sockaddr*, int, void*) (Socket.cpp:71)
==2933==    by 0x5783804: listener_read_cb (listener.c:377)
==2933==    by 0x57796BB: event_base_loop (event.c:1287)
==2933==    by 0x4CF773: robolab::Socket::startup() (Socket.cpp:226)
==2933==    by 0x48ADF1: robolab::ClientServer::startup() (ClientServer.cpp:117)
==2933==    by 0x473A76: serverThreadCB(void*) (Test_EchoClientServer.cpp:47)
==2933==    by 0x66519C9: start_thread (pthread_create.c:300)
==2933==    by 0x75526FC: clone (clone.S:112)
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.