[PATCH v6] locale: memory leak in newlocale [BZ #25770]
Andreas Schwab
schwab@suse.de
Mon Jun 2 09:32:56 GMT 2025
On Mai 27 2025, Dmitry Kovalenko wrote:
> @@ -38,19 +39,21 @@ __libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden)
> } while (0)
>
>
> -locale_t
> -__newlocale (int category_mask, const char *locale, locale_t base)
> +static locale_t
> +__newlocale_1 (int category_mask, const char *locale, locale_t base, char ** const locale_path_ptr)
Please fold.
> {
> /* Intermediate memory for result. */
> const char *newnames[__LC_LAST];
> struct __locale_struct result;
> locale_t result_ptr;
> - char *locale_path;
> size_t locale_path_len;
> const char *locpath_var;
> int cnt;
> size_t names_len;
>
> + assert(locale_path_ptr != NULL);
> + assert((*locale_path_ptr) == NULL);
> +
I don't see any point in these assertions. The only caller is below,
which always passes the desired arguments.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
More information about the Libc-alpha
mailing list