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

Re: [Libevent-users] How to read data coming from a POST request



On Fri, Aug 10, 2012 at 15:11 UTC, Riccardo Tacconi wrote:
> void servlet(struct evhttp_request *req, struct evbuffer *evb) {
>     size_t len = evbuffer_get_length(evhttp_request_get_input_buffer(req));
>     struct evbuffer *in_evb = evhttp_request_get_input_buffer(req);
>     char *data;
>     evbuffer_copyout(in_evb, data, len);

data is an uninitialized pointer.  Perhaps

char *data = malloc(len);

would get you over this hump.

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