diff options
author | Wan-Teh Chang <wtc@google.com> | 2022-02-25 21:00:31 +0300 |
---|---|---|
committer | Wan-Teh Chang <wtc@google.com> | 2022-02-25 22:36:58 +0300 |
commit | 65953c862d392868d167ae6c4327d869da8a98ea (patch) | |
tree | 9ce3dba07a7fdb1e79de68b247556cd4cd1596e0 /src | |
parent | 5f8de654d46fbe95967c5603c25b935d3e08b1b1 (diff) |
Unreference c->cache in dav1d_flush()
Fix memory leaks. The 'Dav1dThreadPicture cache' member was added to
struct Dav1dContext in commit f9844476372719fd1acc2a6dec51ca65fa74bbcf.
But it is not unreferenced in dav1d_flush() or dav1d_close().
James Almer pointed out that we should unreference c->out too in
dav1d_flush().
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -517,6 +517,12 @@ int dav1d_apply_grain(Dav1dContext *const c, Dav1dPicture *const out, void dav1d_flush(Dav1dContext *const c) { dav1d_data_unref_internal(&c->in); + if (c->out.p.data[0]) { + dav1d_thread_picture_unref(&c->out); + } + if (c->cache.p.data[0]) { + dav1d_thread_picture_unref(&c->cache); + } c->drain = 0; for (int i = 0; i < 8; i++) { |