freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 8150ed0: [cff, psaux] Avoid memory zeroing (contd.).


From: Werner Lemberg
Subject: [freetype2] master 8150ed0: [cff, psaux] Avoid memory zeroing (contd.).
Date: Wed, 5 May 2021 23:31:34 -0400 (EDT)

branch: master
commit 8150ed0db23ce7d82c6e145636255fab31b90ecf
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    [cff,psaux] Avoid memory zeroing (contd.).
    
    * src/cff/cffload.c (cff_blend_doBlend, cff_blend_build_vector): Tweak
    allocation macros.
    * src/psaux/psarrst.c (cf2_arrstack_setNumElements): Ditto.
    * src/psaux/psstack.c (cf2_stack_init): Ditto.
---
 ChangeLog           |  9 +++++++++
 src/cff/cffload.c   | 14 +++++---------
 src/psaux/psarrst.c |  2 +-
 src/psaux/psstack.c |  3 +--
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 09521f2..24ba393 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-05-05  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+       [cff,psaux] Avoid memory zeroing (contd.).
+
+       * src/cff/cffload.c (cff_blend_doBlend, cff_blend_build_vector): Tweak
+       allocation macros.
+       * src/psaux/psarrst.c (cf2_arrstack_setNumElements): Ditto.
+       * src/psaux/psstack.c (cf2_stack_init): Ditto.
+
 2021-05-04  Ben Wagner  <bungeman@chromium.org>
 
        * src/cid/cidload.c (cid_hex_to_binary): Improve return value.
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 9ad00d8..4a4010d 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1320,9 +1320,9 @@
 
       /* increase or allocate `blend_stack' and reset `blend_top'; */
       /* prepare to append `numBlends' values to the buffer        */
-      if ( FT_REALLOC( subFont->blend_stack,
-                       subFont->blend_alloc,
-                       subFont->blend_alloc + size ) )
+      if ( FT_QREALLOC( subFont->blend_stack,
+                        subFont->blend_alloc,
+                        subFont->blend_alloc + size ) )
         goto Exit;
 
       subFont->blend_top    = subFont->blend_stack + subFont->blend_used;
@@ -1435,9 +1435,7 @@
 
     /* prepare buffer for the blend vector */
     len = varData->regionIdxCount + 1;    /* add 1 for default component */
-    if ( FT_REALLOC( blend->BV,
-                     blend->lenBV * sizeof( *blend->BV ),
-                     len * sizeof( *blend->BV ) ) )
+    if ( FT_QRENEW_ARRAY( blend->BV, blend->lenBV, len ) )
       goto Exit;
 
     blend->lenBV = len;
@@ -1539,9 +1537,7 @@
     if ( lenNDV != 0 )
     {
       /* user has set a normalized vector */
-      if ( FT_REALLOC( blend->lastNDV,
-                       blend->lenNDV * sizeof ( *NDV ),
-                       lenNDV * sizeof ( *NDV ) ) )
+      if ( FT_QRENEW_ARRAY( blend->lastNDV, blend->lenNDV, lenNDV ) )
         goto Exit;
 
       FT_MEM_COPY( blend->lastNDV,
diff --git a/src/psaux/psarrst.c b/src/psaux/psarrst.c
index 8751d27..7f27c24 100644
--- a/src/psaux/psarrst.c
+++ b/src/psaux/psarrst.c
@@ -110,7 +110,7 @@
 
       FT_ASSERT( newSize > 0 );   /* avoid realloc with zero size */
 
-      if ( !FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) )
+      if ( !FT_QREALLOC( arrstack->ptr, arrstack->totalSize, newSize ) )
       {
         arrstack->allocated = numElements;
         arrstack->totalSize = newSize;
diff --git a/src/psaux/psstack.c b/src/psaux/psstack.c
index 72047e9..bc8888c 100644
--- a/src/psaux/psstack.c
+++ b/src/psaux/psstack.c
@@ -59,10 +59,9 @@
     CF2_Stack  stack = NULL;
 
 
-    if ( FT_NEW( stack ) )
+    if ( FT_QNEW( stack ) )
       return NULL;
 
-    /* initialize the structure; FT_NEW zeroes it */
     stack->memory = memory;
     stack->error  = e;
 



reply via email to

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