* tests/test-localename.c (test_locale_name)
(test_locale_name_thread): Don't call freelocale on a locale
that was the base of a successful newlocale, as that
results in a double free. Problem reported by Assaf Gordon.
(test_locale_name_thread): Free saved names after use, to pacify
gcc -fsanitize=address.
+2016-03-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ localename-tests: memory allocation fixes
+ * tests/test-localename.c (test_locale_name)
+ (test_locale_name_thread): Don't call freelocale on a locale
+ that was the base of a successful newlocale, as that
+ results in a double free. Problem reported by Assaf Gordon.
+ (test_locale_name_thread): Free saved names after use, to pacify
+ gcc -fsanitize=address.
+
2016-03-08 Paul Eggert <eggert@cs.ucla.edu>
intprops: make .h file license match module
if (loc != NULL)
{
locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
- if (locale != NULL)
+ if (locale == NULL)
+ freelocale (loc);
+ else
{
unsigned int j;
uselocale (LC_GLOBAL_LOCALE);
freelocale (locale);
}
- freelocale (loc);
}
}
}
if (loc != NULL)
{
locale_t locale = newlocale (category_mask, "de_DE.UTF-8", loc);
- if (locale != NULL)
+ if (locale == NULL)
+ freelocale (loc);
+ else
{
unsigned int j;
uselocale (LC_GLOBAL_LOCALE);
freelocale (locale);
}
- freelocale (loc);
}
}
}
unsigned int i;
for (i = 0; i < SIZEOF (categories); i++)
- ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
+ {
+ ASSERT (strcmp (unsaved_names[j][i], saved_names[j][i]) == 0);
+ free (saved_names[j][i]);
+ }
}
}
#else