player: properly destroy client context if thread can't be created

Minor leak in an obscure out of memory case.
This commit is contained in:
wm4 2015-04-30 21:57:08 +02:00
parent 8c7f3adb41
commit d01228058b
1 changed files with 4 additions and 1 deletions

View File

@ -135,8 +135,11 @@ static void mp_load_script(struct MPContext *mpctx, const char *fname)
MP_VERBOSE(arg, "Loading script %s...\n", fname);
pthread_t thread;
if (pthread_create(&thread, NULL, script_thread, arg))
if (pthread_create(&thread, NULL, script_thread, arg)) {
mpv_detach_destroy(arg->client);
talloc_free(arg);
return;
}
wait_loaded(mpctx);
MP_VERBOSE(mpctx, "Done loading %s.\n", fname);