diff options
author | Johannes Weberhofer <jweberhofer@weberhofer.at> | 2016-03-03 17:13:33 +0300 |
---|---|---|
committer | Johannes Weberhofer <jweberhofer@weberhofer.at> | 2016-03-03 17:13:33 +0300 |
commit | 77fc69c557d9fbd4838b2957c2650fd0f63b3196 (patch) | |
tree | 71c426f880c850aa031f40ce26c2c2d8ffbf69a5 /remmina | |
parent | 0e935eb89199053c210e61cc9e5603a90bf6bb8c (diff) |
pos_cache not nulled upon realloc failure
Diffstat (limited to 'remmina')
-rw-r--r-- | remmina/src/remmina_survey.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/remmina/src/remmina_survey.c b/remmina/src/remmina_survey.c index 49f77907c..8c3961ff4 100644 --- a/remmina/src/remmina_survey.c +++ b/remmina/src/remmina_survey.c @@ -91,9 +91,11 @@ static char *repl_str(const char *str, const char *old, const char *new) /* Increase the cache size when necessary. */ if (cache_sz < count) { cache_sz += cache_sz_inc; - pos_cache = realloc(pos_cache, sizeof(*pos_cache) * cache_sz); - if (pos_cache == NULL) { + pos_cache_new = realloc(pos_cache, sizeof(*pos_cache) * cache_sz); + if (pos_cache_new == NULL) { goto end_repl_str; + } else { + pos_cache = pos_cache_new; } cache_sz_inc *= cache_sz_inc_factor; if (cache_sz_inc > cache_sz_inc_max) { |