Commit a8d24ea1 authored by Janne Grunau's avatar Janne Grunau Committed by Henrik Gramner

API: always unref input buffer after consuming it completely

parent c5d283bd
......@@ -196,8 +196,8 @@ int dav1d_decode(Dav1dContext *const c,
assert(res <= in->sz);
in->sz -= res;
in->data += res;
if (!in->sz) dav1d_data_unref(in);
if (c->out.data[0]) {
if (!in->sz) dav1d_data_unref(in);
dav1d_picture_ref(out, &c->out);
dav1d_picture_unref(&c->out);
return 0;
......
......@@ -72,11 +72,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
err = dav1d_decode(ctx, &buf, &pic);
if (err == 0) {
dav1d_picture_unref(&pic);
} else {
if (!buf.sz) dav1d_data_unref(&buf);
if (err != -EAGAIN) {
break;
}
} else if (err != -EAGAIN) {
break;
}
} while (buf.sz > 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment