[base] Don't zero out allocated memory twice (#51816).
Patch applied from bug report. * src/base/ftutil.c (ft_mem_qrealloc): Use low-level allocation to avoid unnecessary overhead.
This commit is contained in:
parent
0aca17cf53
commit
bd28952e23
@ -1,3 +1,12 @@
|
||||
2017-08-22 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[base] Don't zero out allocated memory twice (#51816).
|
||||
|
||||
Patch applied from bug report.
|
||||
|
||||
* src/base/ftutil.c (ft_mem_qrealloc): Use low-level allocation to
|
||||
avoid unnecessary overhead.
|
||||
|
||||
2017-08-22 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[truetype] Integer overflow.
|
||||
|
@ -135,7 +135,7 @@
|
||||
ft_mem_free( memory, block );
|
||||
block = NULL;
|
||||
}
|
||||
else if ( new_count > FT_INT_MAX/item_size )
|
||||
else if ( new_count > FT_INT_MAX / item_size )
|
||||
{
|
||||
error = FT_THROW( Array_Too_Large );
|
||||
}
|
||||
@ -143,13 +143,15 @@
|
||||
{
|
||||
FT_ASSERT( !block );
|
||||
|
||||
block = ft_mem_alloc( memory, new_count*item_size, &error );
|
||||
block = memory->alloc( memory, new_count * item_size );
|
||||
if ( block == NULL )
|
||||
error = FT_THROW( Out_Of_Memory );
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_Pointer block2;
|
||||
FT_Long cur_size = cur_count*item_size;
|
||||
FT_Long new_size = new_count*item_size;
|
||||
FT_Long cur_size = cur_count * item_size;
|
||||
FT_Long new_size = new_count * item_size;
|
||||
|
||||
|
||||
block2 = memory->realloc( memory, cur_size, new_size, block );
|
||||
|
Loading…
Reference in New Issue
Block a user