shithub: dav1d

Download patch

ref: f821d9ad7b6c13cb52f226df473af4818cb619ed
parent: 3680b11a60ed63893705d877c75e78a1a4860f3c
author: James Almer <jamrial@gmail.com>
date: Sat Mar 16 15:46:18 EDT 2019

decode: don't realloc the tile data buffer when it needs to be enlarged

Its previous contents don't need to be preserved.

--- a/src/decode.c
+++ b/src/decode.c
@@ -3195,9 +3195,9 @@
 
     // FIXME qsort so tiles are in order (for frame threading)
     if (f->n_tile_data_alloc < c->n_tile_data) {
-        struct Dav1dTileGroup *tile = realloc(f->tile, c->n_tile_data * sizeof(*f->tile));
-        if (!tile) goto error;
-        f->tile = tile;
+        freep(&f->tile);
+        f->tile = malloc(c->n_tile_data * sizeof(*f->tile));
+        if (!f->tile) goto error;
         f->n_tile_data_alloc = c->n_tile_data;
     }
     memcpy(f->tile, c->tile, c->n_tile_data * sizeof(*f->tile));