[vlc-devel] [PATCH] error.c: cover the case when newlocale fails and returns a null locale object

Rémi Denis-Courmont remi at remlab.net
Mon Jul 7 11:24:57 CEST 2014

Le 2014-07-07 12:05, Casian Andrei a écrit :
> If the current locale settings on a system are somehow broken, the
> newlocale function can fail and return a null locale object.

Sorry but that is too fuzzy a problem description in my opinion.

> According to the documentation, subsequent calls to strerror_l
> and freelocale have an undefined behavior.

True but (vlc_)strerror_l() cannot return NULL ever anyway. So the 
patch is buggy.

> When newlocale fails, return NULL, and cover this case in
> vlc_strerror, where vlc_error_c can be used as a backup.

I find addressing a failure of newlocale() with another call to 
newlocale() dubious.

Rémi Denis-Courmont

More information about the vlc-devel mailing list