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

[Libevent-users] evhttp_request_free segfaults



I'm writing a little HTTP server in C with libevent-2.0.3-alpha.
Somewhere in my code I  call evhttp_request_own then I put a pointer to the evhttp_request object in an array shared with another thread.
In the other thread, I retrieve the evhttp_request pointer and send a reply with evhttp_send_reply, and when  I try to  call evhttp_request_free to release memory allocated to the evhttp_request object, it produce a segfault.
Here is the stack trace I get using GDB :


#0  0x00007ffff7bc48b7 in evhttp_clear_headers (headers=0x602ad0) at http.c:1349
#1  0x00007ffff7bc4c3e in evhttp_request_free (req=0x602fb0) at http.c:2814
#2  0x00007ffff7bc6b96 in evhttp_send_done (evcon=0x602af0, arg=<value optimized out>) at http.c:1983
#3  0x00007ffff7bbea48 in bufferevent_writecb (fd=18, event=<value optimized out>, arg=0x602c50) at bufferevent_sock.c:262
#4  0x00007ffff7bb6020 in event_process_active_single_queue (base=0x602030, flags=<value optimized out>) at event.c:925
#5  event_process_active (base=0x602030, flags=<value optimized out>) at event.c:978
#6  event_base_loop (base=0x602030, flags=<value optimized out>) at event.c:1156
#7  0x0000000000401404 in main (argc=1, argv=0x7fffffffe558) at ../src/Frontend.c:184