freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 2468e59: [type42] Avoid some memory zeroing.


From: Werner Lemberg
Subject: [freetype2] master 2468e59: [type42] Avoid some memory zeroing.
Date: Thu, 20 May 2021 22:21:20 -0400 (EDT)

branch: master
commit 2468e59af1701d86260ee8f3ff7a959e5479fc1d
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [type42] Avoid some memory zeroing.
    
    * src/type42/t42objs.c (T42_Open_Face): Tweak allocation macro.
    * src/type42/t42parse.c (t42_parse_sfnts): Ditto.
---
 ChangeLog             | 7 +++++++
 src/type42/t42objs.c  | 2 +-
 src/type42/t42parse.c | 8 ++++----
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0a63e60..f40c31a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-20  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+       [type42] Avoid some memory zeroing.
+
+       * src/type42/t42objs.c (T42_Open_Face): Tweak allocation macro.
+       * src/type42/t42parse.c (t42_parse_sfnts): Ditto.
+
 2021-05-19  Nikolaus Waxweiler  <madigens@gmail.com>
 
        [CMake] Update dependency finders.
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index a8acf9f..59b6540 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -44,7 +44,7 @@
 
     parser = &loader.parser;
 
-    if ( FT_ALLOC( face->ttf_data, 12 ) )
+    if ( FT_QALLOC( face->ttf_data, 12 ) )
       goto Exit;
 
     /* while parsing the font we always update `face->ttf_size' so that */
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index 9cd9e6c..ea2c519 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -614,7 +614,7 @@
           error = FT_THROW( Invalid_File_Format );
           goto Fail;
         }
-        if ( FT_REALLOC( string_buf, old_string_size, string_size ) )
+        if ( FT_QREALLOC( string_buf, old_string_size, string_size ) )
           goto Fail;
 
         allocated = 1;
@@ -718,7 +718,7 @@
               goto Fail;
             }
 
-            if ( FT_REALLOC( face->ttf_data, 12, face->ttf_size ) )
+            if ( FT_QREALLOC( face->ttf_data, 12, face->ttf_size ) )
               goto Fail;
           }
           /* fall through */
@@ -767,8 +767,8 @@
             FT_TRACE2(( "  allocating %ld bytes\n", face->ttf_size + 1 ));
             FT_TRACE2(( "\n" ));
 
-            if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables,
-                             face->ttf_size + 1 ) )
+            if ( FT_QREALLOC( face->ttf_data, 12 + 16 * num_tables,
+                              face->ttf_size + 1 ) )
               goto Fail;
           }
           /* fall through */



reply via email to

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