Comment #26 on issue 99 by [email protected]: Memcached 1.4.2 server segmentation fault
http://code.google.com/p/memcached/issues/detail?id=99

I believe the attached patch will correct the problem. It addresses the issue of using a variable that has no value ever set to it (as my C example showed that the internal libevent event.ev_base member never gets assigned a value). Your patch does now use the conn.thread.base variable which gets set to the appropriated main_base through thread_init().

Your patch also mirrors a similar change in 1.6.0-beta1 in a less roundabout way. If you look at line 5510 of daemon/memcache.c, you will notice:

        c->event.ev_base = tp->base;

It assigns event.ev_base to the thread.base, but I like your change better as you do not touch an internal variable in the libevent event structure, which could be subject to change in later libevent releases.

Hope this helps and gives you more confidence in your patch :)

Reply via email to