diff options
author | dormando <dormando@rydia.net> | 2017-10-29 15:16:31 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2017-10-29 15:16:31 -0700 |
commit | a906f77ebda87c339da6160fb01bf5694555d24d (patch) | |
tree | 7452d72a96b9cb45f3c68446f97c0d39f84dba2d /items.c | |
parent | dd4acbaf76344e357aedbf4f33bc7fdfec846fc7 (diff) | |
download | memcached-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.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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(); |