freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 58395dd20: [woff] Don't allocate table entries until


From: Werner Lemberg
Subject: [freetype2] master 58395dd20: [woff] Don't allocate table entries until needed
Date: Tue, 14 Jun 2022 00:49:25 -0400 (EDT)

branch: master
commit 58395dd20040d8026edaf0e5a71f1ea782857deb
Author: Ben Wagner <bungeman@chromium.org>
Commit: Ben Wagner <bungeman@chromium.org>

    [woff] Don't allocate table entries until needed
    
    * src/sfnt/sfwoff.c (woff_open_font): delay allocating space for the
    table entries until they are actually written out with the data.
---
 src/sfnt/sfwoff.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/sfnt/sfwoff.c b/src/sfnt/sfwoff.c
index 54c63c420..3f9dd7a55 100644
--- a/src/sfnt/sfwoff.c
+++ b/src/sfnt/sfwoff.c
@@ -162,8 +162,7 @@
     }
 
     /* Don't trust `totalSfntSize' before thorough checks. */
-    if ( FT_QALLOC( sfnt, 12 + woff.num_tables * 16UL ) ||
-         FT_NEW( sfnt_stream )                          )
+    if ( FT_QALLOC( sfnt, 12 ) || FT_NEW( sfnt_stream ) )
       goto Exit;
 
     sfnt_header = sfnt;
@@ -328,9 +327,7 @@
     }
 
     /* Now use `totalSfntSize'. */
-    if ( FT_QREALLOC( sfnt,
-                      12 + woff.num_tables * 16UL,
-                      woff.totalSfntSize ) )
+    if ( FT_QREALLOC( sfnt, 12, woff.totalSfntSize ) )
       goto Exit;
 
     sfnt_header = sfnt + 12;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]