summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2021-07-23 15:22:16 +0300
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2021-07-23 17:50:24 +0300
commit5ed0338eea505685e2beef36eec04fa9cb0f6d78 (patch)
treef5ae18f3c0ee5ac7ae6611c27af95b5d49d7b281 /video/out
parent36b7cff5826f2d9352831bce9a6a84a638acb44b (diff)
downloadmpv-5ed0338eea505685e2beef36eec04fa9cb0f6d78.tar.bz2
mpv-5ed0338eea505685e2beef36eec04fa9cb0f6d78.tar.xz
js: fix tiny leaks if js_try throws(!)
As it turns out, js_try can throw if it runs out of try-stack (without/before entering either the try part or the catch part). If it happens, then C code which does allocation -> try will leak. In mpv there were two places which do alloc and then try, one of them as part of the autofree system. On both cases the leak is the smallest possible (zero allocation) - talloc_new(NULL); It's very unlikely to trigger - an autofree mpv API should be called when the try-stack is exactly full, and our next try will throw (and guaranteed to get caught at an outer level, but with a leak). Fix that by doing the allocation inside the try block, so that if try throws before it's entered then nothing got allocated/leaked. Mujs internal code also has/had similar leaks, which are getting fixed around this time (July 2021, post mujs 1.1.3). [1] exhaust the try-stack or call-stack, whichever comes first: function kaboom() { try { kaboom() } catch(e) {} }
Diffstat (limited to 'video/out')
0 files changed, 0 insertions, 0 deletions