From 60705383eb4c2952c2500604198e489781865e69 Mon Sep 17 00:00:00 2001 From: martii Date: Sat, 9 Nov 2013 17:07:53 +0100 Subject: [PATCH] system/localize: change memory allocation, no user-visible changes (continued) --- src/system/localize.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/system/localize.cpp b/src/system/localize.cpp index 61c67b8af..6a3f2cb1d 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -222,8 +222,15 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l if(buf) free(buf); char *_mem = (char *) realloc(*mem, memp - *mem); - if (_mem) // I see no reason for realloc to fail here, but anyways ... - *mem = _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])