summaryrefslogtreecommitdiffstats
path: root/player/scripting.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-30 21:57:08 +0200
committerwm4 <wm4@nowhere>2015-04-30 21:57:08 +0200
commitd01228058b03df33a3c6be3acbf2757019a9cd83 (patch)
treecc8aa0c129f310d1db37caa0d707d495c523637e /player/scripting.c
parent8c7f3adb413ccea35aef3878f020d6a10e9ad5de (diff)
downloadmpv-d01228058b03df33a3c6be3acbf2757019a9cd83.tar.bz2
mpv-d01228058b03df33a3c6be3acbf2757019a9cd83.tar.xz
player: properly destroy client context if thread can't be created
Minor leak in an obscure out of memory case.
Diffstat (limited to 'player/scripting.c')
-rw-r--r--player/scripting.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/player/scripting.c b/player/scripting.c
index d8fbb6f84e..3747f50884 100644
--- a/player/scripting.c
+++ b/player/scripting.c
@@ -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);