src/system/localize.cpp Undefined allocation of 0 bytes

This commit is contained in:
Jacek Jendrzej
2016-06-04 16:19:57 +02:00
parent 75a96a2fb3
commit eb2c84434a

View File

@@ -223,17 +223,18 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l
fclose(fd);
if(buf)
free(buf);
char *_mem = (char *) realloc(*mem, memp - *mem);
if (_mem) {
if (_mem != *mem) {
// most likely doesn't happen
for(unsigned int i = 1; i < sizeof(locale_real_names)/sizeof(const char *); i++)
if (loadData[i] != locale_real_names[i])
loadData[i] -= *mem - _mem;
*mem = _mem;
if(memp - *mem > 0){
char *_mem = (char *) realloc(*mem, memp - *mem);
if (_mem) {
if (_mem != *mem) {
// most likely doesn't happen
for(unsigned int i = 1; i < sizeof(locale_real_names)/sizeof(const char *); i++)
if (loadData[i] != locale_real_names[i])
loadData[i] -= *mem - _mem;
*mem = _mem;
}
}
}
for (unsigned j = 1; j < (sizeof(locale_real_names)/sizeof(const char *)); j++)
if (loadData[j] == locale_real_names[j])
{