[vlc-devel] [PATCH] Android: implement vlc_strerror and vlc_strerror_c
Edward Wang
edward.c.wang at compdigitec.com
Fri Jan 3 15:24:53 CET 2014
On 2014-01-03 06:10, Rémi Denis-Courmont <remi at remlab.net> wrote:
>> +const char *vlc_strerror(int errnum)
>> >+{
>> >+ char* buf = malloc(100);
> This looks like a memory leak to me.
>
>
It seems that according to
http://stackoverflow.com/questions/19640640/what-to-do-with-the-pointer-returned-by-strerror-r-function
the buffer must always be allocated by us if the function follows the
POSIX standard.
Bionic libc declares it as:
extern int strerror_r(int errnum, char *buf, size_t n);
So it appears to follows POSIX rather than the GNU extension, which
means the buffer must be allocated for it.
However, wouldn't using a static buffer not be thread-safe though?
Thanks,
Edward Wang
More information about the vlc-devel
mailing list