Fix use-after-free in imagequant

This commit is contained in:
Ingvar Stepanyan
2020-05-14 16:32:24 +01:00
committed by Ingvar Stepanyan
parent 45785bcca3
commit 4fc18de5f9

View File

@@ -15,7 +15,9 @@ export async function process(data: ImageData, opts: QuantizeOptions): Promise<I
:
module.quantize(data.data, data.width, data.height, opts.maxNumColors, opts.dither);
const imgData = new ImageData(new Uint8ClampedArray(result.buffer), result.width, result.height);
module.free_result();
return new ImageData(new Uint8ClampedArray(result.buffer), result.width, result.height);
return imgData;
}