@@ -92,10 +92,9 @@ cache_t *ThreeLCache_init(const common_cache_params_t ccache_params,
9292 ThreeLCache_params_t *params = my_malloc (ThreeLCache_params_t);
9393 cache->eviction_params = params;
9494
95+ ThreeLCache_parse_params (cache, DEFAULT_PARAMS);
9596 if (cache_specific_params != NULL ) {
9697 ThreeLCache_parse_params (cache, cache_specific_params);
97- } else {
98- ThreeLCache_parse_params (cache, DEFAULT_PARAMS);
9998 }
10099
101100 auto *ThreeLCache = new ThreeLCache::ThreeLCacheCache ();
@@ -131,6 +130,9 @@ static void ThreeLCache_free(cache_t *cache) {
131130 static_cast <ThreeLCache::ThreeLCacheCache *>(params->ThreeLCache_cache );
132131 delete ThreeLCache;
133132 free (cache->to_evict_candidate );
133+ if (params->objective != NULL ) {
134+ free (params->objective );
135+ }
134136 my_free (sizeof (ThreeLCache_params_t), params);
135137 cache_struct_free (cache);
136138}
@@ -340,6 +342,9 @@ static void ThreeLCache_parse_params(cache_t *cache,
340342 }
341343
342344 if (strcasecmp (key, " objective" ) == 0 ) {
345+ if (params->objective != NULL ) {
346+ free (params->objective );
347+ }
343348 params->objective = strdup (value);
344349 if (params->objective == NULL ) {
345350 ERROR (" out of memory %s\n " , strerror (errno));
0 commit comments