shithub: dav1d

Download patch

ref: 67bab2ba199ad42e6d18aac1198ec059489d3c20
parent: 13389e68a6a6454779356a27ace28183dc30f719
author: Janne Grunau <[email protected]>
date: Sat Oct 13 06:05:15 EDT 2018

tools/dav1d: unref input data after decoding loop

When breaking out of the decoding either through an error or reaching
the limit of decoded frames the input buffer might not be fully consumed
by the previous dav1d_decode() call. Fixes a memory leak discovered
while testing with frame and tile threads with --limit.

--- a/tools/dav1d.c
+++ b/tools/dav1d.c
@@ -132,6 +132,8 @@
             break;
     } while (data.sz > 0 || !input_read(in, &data));
 
+    if (data.sz > 0) dav1d_data_unref(&data);
+
     // flush
     if (res == 0) while (!cli_settings.limit || n_out < cli_settings.limit) {
         if ((res = dav1d_decode(c, NULL, &p)) < 0) {