Patchwork DCIGETTEXT: Do not make copy of localename

login
register
mail settings
Submitter Florian Weimer
Date June 19, 2017, 4:16 p.m.
Message ID <20170619161657.33121402AEC3C@oldenburg.str.redhat.com>
Download mbox | patch
Permalink /patch/21094/
State Committed
Headers show

Comments

Florian Weimer - June 19, 2017, 4:16 p.m.
2017-06-19  Florian Weimer  <fweimer@redhat.com>

	* intl/dcigettext.c (DCIGETTEXT): Do not make copy of localename.
	It cannot change while __libc_setlocale_lock is acquired.
Adhemerval Zanella Netto - June 19, 2017, 8:49 p.m.
On 19/06/2017 13:16, Florian Weimer wrote:
> 2017-06-19  Florian Weimer  <fweimer@redhat.com>
> 
> 	* intl/dcigettext.c (DCIGETTEXT): Do not make copy of localename.
> 	It cannot change while __libc_setlocale_lock is acquired.

LGTM.

> 
> diff --git a/intl/dcigettext.c b/intl/dcigettext.c
> index 3843b7c..d97746c 100644
> --- a/intl/dcigettext.c
> +++ b/intl/dcigettext.c
> @@ -551,7 +551,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
>  #ifdef HAVE_PER_THREAD_LOCALE
>  # ifndef IN_LIBGLOCALE
>  #  ifdef _LIBC
> -  localename = strdupa (__current_locale_name (category));
> +  localename = __current_locale_name (category);
>  #  else
>    categoryname = category_to_name (category);
>  #   define CATEGORYNAME_INITIALIZED
>

Patch

diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index 3843b7c..d97746c 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -551,7 +551,7 @@  DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
 #ifdef HAVE_PER_THREAD_LOCALE
 # ifndef IN_LIBGLOCALE
 #  ifdef _LIBC
-  localename = strdupa (__current_locale_name (category));
+  localename = __current_locale_name (category);
 #  else
   categoryname = category_to_name (category);
 #   define CATEGORYNAME_INITIALIZED