CAS is broken

Tomash Brechko tomash.brechko at gmail.com
Tue Nov 20 09:57:27 UTC 2007


On Tue, Nov 20, 2007 at 11:38:29 +0300, Tomash Brechko wrote:
> > + * Returns a suffix buffer from the freelist, if any. Should call this using
> > + * suffix_from_freelist() for thread safety.
> > + */
> > +char *do_suffix_from_freelist() {
> > +    char *s;
> > +
> > +    if (freesuffixcurr > 0) {
> > +        s = freesuffix[--freesuffixcurr];
> > +    } else {
> > +        /* FIXME: global define? */
> > +        /* If malloc fails, let the logic fall through without spamming
> > +         * STDERR on the server. */
> > +        s = malloc( sizeof(char *) * SUFFIX_SIZE );

This line is also bogus, it should be

             s = malloc( SUFFIX_SIZE );

as you are allocating character array here, not pointer array.


-- 
   Tomash Brechko


More information about the memcached mailing list