Commit 0b7c37ee by Ilya Verbin Committed by Ilya Verbin

offload_host.cpp (OffloadDescriptor::setup_misc_data): Use calloc instead of malloc.

liboffloadmic/
	* runtime/offload_host.cpp (OffloadDescriptor::setup_misc_data): Use
	calloc instead of malloc.
	(__offload_fini_library): Set mic_engines_total to zero.

Co-Authored-By: Aleksander Ivanushenko <aleksander.ivanushenko@intel.com>

From-SVN: r229368
parent 6a112b50
2015-10-26 Ilya Verbin <ilya.verbin@intel.com>
Aleksander Ivanushenko <aleksander.ivanushenko@intel.com>
* runtime/offload_host.cpp (OffloadDescriptor::setup_misc_data): Use
calloc instead of malloc.
(__offload_fini_library): Set mic_engines_total to zero.
2015-10-13 Ilya Verbin <ilya.verbin@intel.com> 2015-10-13 Ilya Verbin <ilya.verbin@intel.com>
* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New
......
...@@ -2421,8 +2421,8 @@ bool OffloadDescriptor::setup_misc_data(const char *name) ...@@ -2421,8 +2421,8 @@ bool OffloadDescriptor::setup_misc_data(const char *name)
} }
// initialize function descriptor // initialize function descriptor
m_func_desc = (FunctionDescriptor*) malloc(m_func_desc_size + m_func_desc = (FunctionDescriptor*) calloc(1, m_func_desc_size
misc_data_size); + misc_data_size);
if (m_func_desc == NULL) if (m_func_desc == NULL)
LIBOFFLOAD_ERROR(c_malloc); LIBOFFLOAD_ERROR(c_malloc);
m_func_desc->console_enabled = console_enabled; m_func_desc->console_enabled = console_enabled;
...@@ -5087,6 +5087,7 @@ static void __offload_fini_library(void) ...@@ -5087,6 +5087,7 @@ static void __offload_fini_library(void)
OFFLOAD_DEBUG_TRACE(2, "Cleanup offload library ...\n"); OFFLOAD_DEBUG_TRACE(2, "Cleanup offload library ...\n");
if (mic_engines_total > 0) { if (mic_engines_total > 0) {
delete[] mic_engines; delete[] mic_engines;
mic_engines_total = 0;
if (mic_proxy_fs_root != 0) { if (mic_proxy_fs_root != 0) {
free(mic_proxy_fs_root); free(mic_proxy_fs_root);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment