CAS is broken

dormando dormando at rydia.net
Wed Nov 28 00:20:44 UTC 2007


Tomash Brechko wrote:
> 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.
> 
> 

For posterity: I fixed all these.


More information about the memcached mailing list