Changeset 650
- Timestamp:
- 11/21/07 19:58:47 (1 year ago)
- Files:
-
- trunk/server/memcached.c (modified) (6 diffs)
- trunk/server/memcached.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/server/memcached.c
r646 r650 408 408 if (c->suffixleft != 0) { 409 409 for (; c->suffixleft > 0; c->suffixleft--, c->suffixcurr++) { 410 suffix_add_to_freelist(*(c->suffixcurr)); 410 if(suffix_add_to_freelist(*(c->suffixcurr))) { 411 free(*(c->suffixcurr)); 412 } 411 413 } 412 414 } … … 554 556 freesuffixcurr = 0; 555 557 556 freesuffix = (char **)malloc( sizeof(char *) * 557 21 * freesuffixtotal ); 558 freesuffix = (char **)malloc( sizeof(char *) * freesuffixtotal ); 558 559 if (freesuffix == NULL) { 559 560 perror("malloc()"); … … 572 573 s = freesuffix[--freesuffixcurr]; 573 574 } else { 574 /* FIXME: global define? */575 575 /* If malloc fails, let the logic fall through without spamming 576 576 * STDERR on the server. */ … … 591 591 } else { 592 592 /* try to enlarge free connections array */ 593 char **new_freesuffix = realloc(freesuffix, 594 SUFFIX_SIZE * freesuffixtotal * 2); 593 char **new_freesuffix = realloc(freesuffix, freesuffixtotal * 2); 595 594 if (new_freesuffix) { 596 595 freesuffixtotal *= 2; … … 1242 1241 c->suffixsize *= 2; 1243 1242 c->suffixlist = new_suffix_list; 1244 } 1243 } else break; 1245 1244 } 1246 1245 … … 2220 2219 while (c->suffixleft > 0) { 2221 2220 char *suffix = *(c->suffixcurr); 2222 suffix_add_to_freelist(suffix); 2221 if(suffix_add_to_freelist(suffix)) { 2222 /* Failed to add to freelist, don't leak */ 2223 free(suffix); 2224 } 2223 2225 c->suffixcurr++; 2224 2226 c->suffixleft--; trunk/server/memcached.h
r646 r650 18 18 #define MAX_SENDBUF_SIZE (256 * 1024 * 1024) 19 19 /* I'm told the max legnth of a 64-bit num converted to string is 20 bytes. 20 * Plus one for good luck.*/21 #define SUFFIX_SIZE 2 120 * Plus a few for spaces, \r\n, \0 */ 21 #define SUFFIX_SIZE 24 22 22 23 23 /** Initial size of list of items being returned by "get". */
