The problem is that 'configs' defined as
yagl_host_handle *configs = NULL;
but code above, when doing sizeof(configs), doesn't want to know a size of
host pointer, it wants to know sizeof yagl_host_handle type, which is hardcoded
to 4 bytes. This wasn't a problem on 32 bit machines since sizeof(pointer) would
return 4 in that case. But in case of 64-bit hosts, it causes memory corruption.
Fix is simple, change it to sizeof(*configs)
Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
YAGL_LOG_DEBUG("chosen %d configs", num_config);
- if (!yagl_mem_prepare(egl_api_ts->ts->mt1, configs_, num_config * sizeof(configs)) ||
+ if (!yagl_mem_prepare(egl_api_ts->ts->mt1, configs_, num_config * sizeof(*configs)) ||
!yagl_mem_prepare_EGLint(egl_api_ts->ts->mt2, num_config_)) {
res = false;
goto out;