Browse Source

fix memleak in cache_disable: if the application disabled the cache on the fly, we still need to free the cache_sent array

Samuel Thibault 7 years ago
parent
commit
d20a2069af
1 changed files with 2 additions and 1 deletions
  1. 2 1
      mpi/src/starpu_mpi_cache.c

+ 2 - 1
mpi/src/starpu_mpi_cache.c

@@ -106,11 +106,12 @@ void _starpu_mpi_cache_data_clear(starpu_data_handle_t data_handle)
 	struct _starpu_mpi_data *mpi_data = data_handle->mpi_data;
 	struct _starpu_data_entry *entry;
 
+	free(mpi_data->cache_sent);
+
 	if (_starpu_cache_enabled == 0) return;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	_starpu_mpi_cache_flush_nolock(data_handle);
-	free(mpi_data->cache_sent);
 	HASH_FIND_PTR(_cache_data, &data_handle, entry);
 	if (entry != NULL)
 	{