1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 10:57:35 +00:00

LibGfx/JPEG: Ensure capacity of vector instead of blindly appending

This commit is contained in:
Lucas CHOLLET 2023-04-29 20:12:42 -04:00 committed by Andreas Kling
parent f4014f898d
commit 011fe0d9ba

View file

@ -892,6 +892,7 @@ static ErrorOr<void> read_huffman_table(Stream& stream, JPEGLoadingContext& cont
}
table.codes.ensure_capacity(total_codes);
table.symbols.ensure_capacity(total_codes);
// Read symbols. Read X bytes, where X is the sum of the counts of codes read in the previous step.
for (u32 i = 0; i < total_codes; i++) {