freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [truetype] Avoid some memory zeroing in


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [truetype] Avoid some memory zeroing in variations.
Date: Sun, 07 Nov 2021 03:05:28 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

1 changed file:

Changes:

  • src/truetype/ttgxvar.c
    ... ... @@ -178,7 +178,7 @@
    178 178
         /* in the nested loops below we increase `i' twice; */
    
    179 179
         /* it is faster to simply allocate one more slot    */
    
    180 180
         /* than to add another test within the loop         */
    
    181
    -    if ( FT_NEW_ARRAY( points, n + 1 ) )
    
    181
    +    if ( FT_QNEW_ARRAY( points, n + 1 ) )
    
    182 182
           return NULL;
    
    183 183
     
    
    184 184
         *point_cnt = n;
    
    ... ... @@ -271,7 +271,7 @@
    271 271
         FT_UNUSED( error );
    
    272 272
     
    
    273 273
     
    
    274
    -    if ( FT_NEW_ARRAY( deltas, delta_cnt ) )
    
    274
    +    if ( FT_QNEW_ARRAY( deltas, delta_cnt ) )
    
    275 275
           return NULL;
    
    276 276
     
    
    277 277
         i          = 0;
    
    ... ... @@ -402,7 +402,7 @@
    402 402
           goto Exit;
    
    403 403
         }
    
    404 404
     
    
    405
    -    if ( FT_NEW_ARRAY( blend->avar_segment, axisCount ) )
    
    405
    +    if ( FT_QNEW_ARRAY( blend->avar_segment, axisCount ) )
    
    406 406
           goto Exit;
    
    407 407
     
    
    408 408
         segment = &blend->avar_segment[0];
    
    ... ... @@ -411,8 +411,8 @@
    411 411
           FT_TRACE5(( "  axis %d:\n", i ));
    
    412 412
     
    
    413 413
           segment->pairCount = FT_GET_USHORT();
    
    414
    -      if ( (FT_ULong)segment->pairCount * 4 > table_len                ||
    
    415
    -           FT_NEW_ARRAY( segment->correspondence, segment->pairCount ) )
    
    414
    +      if ( (FT_ULong)segment->pairCount * 4 > table_len                 ||
    
    415
    +           FT_QNEW_ARRAY( segment->correspondence, segment->pairCount ) )
    
    416 416
           {
    
    417 417
             /* Failure.  Free everything we have done so far.  We must do */
    
    418 418
             /* it right now since loading the `avar' table is optional.   */
    
    ... ... @@ -492,7 +492,7 @@
    492 492
     
    
    493 493
         /* make temporary copy of item variation data offsets; */
    
    494 494
         /* we will parse region list first, then come back     */
    
    495
    -    if ( FT_NEW_ARRAY( dataOffsetArray, itemStore->dataCount ) )
    
    495
    +    if ( FT_QNEW_ARRAY( dataOffsetArray, itemStore->dataCount ) )
    
    496 496
           goto Exit;
    
    497 497
     
    
    498 498
         for ( i = 0; i < itemStore->dataCount; i++ )
    
    ... ... @@ -1594,7 +1594,7 @@
    1594 1594
           goto Exit;
    
    1595 1595
     
    
    1596 1596
         /* offsets (one more offset than glyphs, to mark size of last) */
    
    1597
    -    if ( FT_NEW_ARRAY( blend->glyphoffsets, gvar_head.glyphCount + 1 ) )
    
    1597
    +    if ( FT_QNEW_ARRAY( blend->glyphoffsets, gvar_head.glyphCount + 1 ) )
    
    1598 1598
           goto Fail2;
    
    1599 1599
     
    
    1600 1600
         if ( gvar_head.flags & 1 )
    
    ... ... @@ -1673,8 +1673,8 @@
    1673 1673
             goto Fail;
    
    1674 1674
           }
    
    1675 1675
     
    
    1676
    -      if ( FT_NEW_ARRAY( blend->tuplecoords,
    
    1677
    -                         gvar_head.axisCount * gvar_head.globalCoordCount ) )
    
    1676
    +      if ( FT_QNEW_ARRAY( blend->tuplecoords,
    
    1677
    +                          gvar_head.axisCount * gvar_head.globalCoordCount ) )
    
    1678 1678
             goto Fail2;
    
    1679 1679
     
    
    1680 1680
           for ( i = 0; i < gvar_head.globalCoordCount; i++ )
    


  • reply via email to

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