1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-18 13:47:04 +00:00

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

Minor leak in an obscure out of memory case.

(cherry picked from commit d01228058b)
This commit is contained in:
wm4 2015-04-30 21:57:08 +02:00 committed by Diogo Franco (Kovensky)
parent a4ba496539
commit b99f78412b

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); MP_VERBOSE(arg, "Loading script %s...\n", fname);
pthread_t thread; 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); talloc_free(arg);
return;
}
wait_loaded(mpctx); wait_loaded(mpctx);
MP_VERBOSE(mpctx, "Done loading %s.\n", fname); MP_VERBOSE(mpctx, "Done loading %s.\n", fname);