Browse Source

libvlc: ensure that vlc_threadvar_set() is set on a proper thread var

If there's an error, the value we set is not actually set. Maybe an old value
is still in there or the variable is gone or something else is blocking.

We can't use the new value in the future and we don't know if the old value is
still in there.
pull/134/head
Steve Lhomme 5 years ago
committed by Rémi Denis-Courmont
parent
commit
1c61389607
  1. 8
      lib/error.c

8
lib/error.c

@ -89,7 +89,9 @@ const char *libvlc_errmsg (void)
void libvlc_clearerr (void)
{
free_error ();
vlc_threadvar_set (context, NULL);
int ret = vlc_threadvar_set (context, NULL);
if(unlikely(ret != 0))
abort();
}
/**
@ -106,7 +108,9 @@ const char *libvlc_vprinterr (const char *fmt, va_list ap)
msg = (char *)oom;
free_error ();
vlc_threadvar_set (context, msg);
int ret = vlc_threadvar_set (context, msg);
if(unlikely(ret != 0))
abort();
return msg;
}

Loading…
Cancel
Save