Re: [PATCH v9] locale: memory leak in newlocale [BZ #25770]
Dmitry Kovalenko
d.kovalenko@postgrespro.ru
Thu Jun 5 10:53:40 GMT 2025
>But I think Andreas doesn't want the assert compiled in even without
>-DNDEBUG.
Ok, I will remove them both
+ assert (locale_path_ptr != NULL);
+ assert (*locale_path_ptr == NULL);
Should I add an initialization of locale_path_ptr into __newlocale_1 and remove it from __newlocale?
------
+static locale_t
+__newlocale_1 (int category_mask, const char *locale, locale_t base,
+ char ** const locale_path_ptr)
+ // ...
+ (*locale_path_ptr) = NULL;
------
+locale_t
+__newlocale (int category_mask, const char *locale, locale_t base)
+{
+ char *tmp_buffer; /* NO INITIALIZATION */
+
+ const locale_t result = __newlocale_1 (category_mask, locale,
+ base, &tmp_buffer);
I think it will be more correctly.
Dmitry Kovalenko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250605/b77a59fc/attachment.htm>
More information about the Libc-alpha
mailing list