Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWan-Teh Chang <wtc@google.com>2022-02-25 21:00:31 +0300
committerWan-Teh Chang <wtc@google.com>2022-02-25 22:36:58 +0300
commit65953c862d392868d167ae6c4327d869da8a98ea (patch)
tree9ce3dba07a7fdb1e79de68b247556cd4cd1596e0 /src
parent5f8de654d46fbe95967c5603c25b935d3e08b1b1 (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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib.c b/src/lib.c
index 5a61d19..010c77f 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -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++) {