Commit 44b1ebe51465f0be2dcf2105e41febe139617cd1

Alexei Podtelezhnikov 2021-04-22T22:34:05

[base] s/FT_ALLOC/FT_QALLOC/ for initialized buffers. * src/base/ftobjs.c (open_face_PS_from_sfnt_stream, Mac_Read_sfnt_Resource): Do not zero out the buffer. * src/base/ftmac.c (FT_New_Face_From_SFNT, read_lwfn): Ditto. * src/base/ftrfork.c (raccess_make_file_name, raccess_guess_darwin_hfsplus, raccess_guess_darwin_newvfs): Ditto.

diff --git a/ChangeLog b/ChangeLog
index 15ee63d..fe9080a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2021-04-20  Alexei Podtelezhnikov  <apodtele@gmail.com>
 
+	[base] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
+
+	* src/base/ftobjs.c (open_face_PS_from_sfnt_stream,
+	Mac_Read_sfnt_Resource): Do not zero out the buffer.
+	* src/base/ftmac.c (FT_New_Face_From_SFNT, read_lwfn): Ditto.
+	* src/base/ftrfork.c (raccess_make_file_name,
+	raccess_guess_darwin_hfsplus, raccess_guess_darwin_newvfs): Ditto.
+
+2021-04-20  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
 	[cache] Restore SBit copying for unowned (BDF) bitmaps.
 
 	* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Restore.
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index eb59ce0..f41c5ee 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -631,7 +631,7 @@
       old_total_size = total_size;
     }
 
-    if ( FT_ALLOC( buffer, (FT_Long)total_size ) )
+    if ( FT_QALLOC( buffer, (FT_Long)total_size ) )
       goto Error;
 
     /* Second pass: append all POST data to the buffer, add PFB fields. */
@@ -752,7 +752,7 @@
     if ( FT_MAC_RFORK_MAX_LEN < sfnt_size )
       return FT_THROW( Array_Too_Large );
 
-    if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
+    if ( FT_QALLOC( sfnt_data, (FT_Long)sfnt_size ) )
     {
       ReleaseResource( sfnt );
       return error;
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index e91f303..3da4f59 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1818,7 +1818,7 @@
     if ( error )
       goto Exit;
 
-    if ( FT_ALLOC( sfnt_ps, (FT_Long)length ) )
+    if ( FT_QALLOC( sfnt_ps, (FT_Long)length ) )
       goto Exit;
 
     error = FT_Stream_Read( stream, (FT_Byte *)sfnt_ps, length );
@@ -2128,7 +2128,7 @@
     if ( error )
       goto Exit;
 
-    if ( FT_ALLOC( sfnt_data, rlen ) )
+    if ( FT_QALLOC( sfnt_data, rlen ) )
       return error;
     error = FT_Stream_Read( stream, (FT_Byte *)sfnt_data, (FT_ULong)rlen );
     if ( error ) {
diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c
index b558437..50203be 100644
--- a/src/base/ftrfork.c
+++ b/src/base/ftrfork.c
@@ -602,7 +602,7 @@
     if ( base_file_len + 6 > FT_INT_MAX )
       return FT_THROW( Array_Too_Large );
 
-    if ( FT_ALLOC( newpath, base_file_len + 6 ) )
+    if ( FT_QALLOC( newpath, base_file_len + 6 ) )
       return error;
 
     FT_MEM_COPY( newpath, base_file_name, base_file_len );
@@ -638,7 +638,7 @@
     if ( base_file_len + 18 > FT_INT_MAX )
       return FT_THROW( Array_Too_Large );
 
-    if ( FT_ALLOC( newpath, base_file_len + 18 ) )
+    if ( FT_QALLOC( newpath, base_file_len + 18 ) )
       return error;
 
     FT_MEM_COPY( newpath, base_file_name, base_file_len );
@@ -874,7 +874,7 @@
 
 
     new_length = ft_strlen( original_name ) + ft_strlen( insertion );
-    if ( FT_ALLOC( new_name, new_length + 1 ) )
+    if ( FT_QALLOC( new_name, new_length + 1 ) )
       return NULL;
 
     tmp = ft_strrchr( original_name, '/' );