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

Re: [Libevent-users] http client code memory leak



> global_base;
> generic_callback() {
>   url = get_user_data(req);
>   for (server : remote_servers) {
>      evcon = evhttp_connection_base_new(global_base, ..);
>      req = evhttp_request_new(client_request_done, req, url);
>      evhttp_make_request(evcon, req);
>   }
> }

evhttp_request_get_connection is intended for the server side; for
client side requests generated by evhttp_request_new there is no
associated connection. Since the request is always passed as a
parameter to the callback, you could pass the connection as your
(void*) context argument and free it there.

Hope that helps,

--nate
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.