summaryrefslogtreecommitdiff
path: root/items.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2017-10-29 15:16:31 -0700
committerdormando <dormando@rydia.net>2017-10-29 15:16:31 -0700
commita906f77ebda87c339da6160fb01bf5694555d24d (patch)
tree7452d72a96b9cb45f3c68446f97c0d39f84dba2d /items.c
parentdd4acbaf76344e357aedbf4f33bc7fdfec846fc7 (diff)
downloadmemcached-a906f77ebda87c339da6160fb01bf5694555d24d.tar.gz
fix use of unitialized array in lru_maintainer
use slightly more modern syntax :P Wasn't really a bug since it'd just sleep too much for a bit or cap it back to the MAX. This will give more consistent behavior though. Thanks to shqking on github for the report
Diffstat (limited to 'items.c')
-rw-r--r--items.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/items.c b/items.c
index 97f8b67..4fe7857 100644
--- a/items.c
+++ b/items.c
@@ -1494,15 +1494,14 @@ static void *lru_maintainer_thread(void *arg) {
useconds_t last_sleep = MIN_LRU_MAINTAINER_SLEEP;
rel_time_t last_crawler_check = 0;
rel_time_t last_automove_check = 0;
- useconds_t next_juggles[MAX_NUMBER_OF_SLAB_CLASSES];
- useconds_t backoff_juggles[MAX_NUMBER_OF_SLAB_CLASSES];
+ useconds_t next_juggles[MAX_NUMBER_OF_SLAB_CLASSES] = {0};
+ useconds_t backoff_juggles[MAX_NUMBER_OF_SLAB_CLASSES] = {0};
struct crawler_expired_data *cdata =
calloc(1, sizeof(struct crawler_expired_data));
if (cdata == NULL) {
fprintf(stderr, "Failed to allocate crawler data for LRU maintainer thread\n");
abort();
}
- memset(next_juggles, 0, sizeof(next_juggles));
pthread_mutex_init(&cdata->lock, NULL);
cdata->crawl_complete = true; // kick off the crawler.
logger *l = logger_create();