Переглянути джерело

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

Lucas CHOLLET 2 роки тому
батько
коміт
011fe0d9ba
1 змінених файлів з 1 додано та 0 видалено
  1. 1 0
      Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp

+ 1 - 0
Userland/Libraries/LibGfx/ImageFormats/JPEGLoader.cpp

@@ -892,6 +892,7 @@ static ErrorOr<void> read_huffman_table(Stream& stream, JPEGLoadingContext& cont
         }
         }
 
 
         table.codes.ensure_capacity(total_codes);
         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.
         // 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++) {
         for (u32 i = 0; i < total_codes; i++) {