diff options
author | Alexei Podtelezhnikov <apodtele@gmail.com> | 2021-09-22 00:30:03 -0400 |
---|---|---|
committer | Alexei Podtelezhnikov <apodtele@gmail.com> | 2021-09-22 00:30:03 -0400 |
commit | b4dddd8244fb59795f030530ad2b401ec4d5b477 (patch) | |
tree | b0c56eeefd3c14af527f0b0fa9f99c8c28980d6a /builds | |
parent | 93866bec77bee6479d8103175562c4fe472c3529 (diff) | |
download | freetype2-b4dddd8244fb59795f030530ad2b401ec4d5b477.tar.gz |
[base] Initialize stream memory earlier.
With Windows memory management tracking heap, it is important to use
it during the stream opening fallback. In Unix, the argument is
unused, but it is better to set it correctly.
* src/base/ftobjs.c (FT_Stream_New): Set memory before calling
`FT_Stream_Open`.
* builds/windows/ftsystem.c, builds/unix/ftsystem.c (FT_Stream_Open,
ft_close_stream_by_free): Call `ft_alloc` and `ft_free` with proper
memory argumment.
Diffstat (limited to 'builds')
-rw-r--r-- | builds/unix/ftsystem.c | 6 | ||||
-rw-r--r-- | builds/windows/ftsystem.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/builds/unix/ftsystem.c b/builds/unix/ftsystem.c index 19ef3a28e..7fc9941d8 100644 --- a/builds/unix/ftsystem.c +++ b/builds/unix/ftsystem.c @@ -233,7 +233,7 @@ FT_CALLBACK_DEF( void ) ft_close_stream_by_free( FT_Stream stream ) { - ft_free( NULL, stream->descriptor.pointer ); + ft_free( stream->memory, stream->descriptor.pointer ); stream->descriptor.pointer = NULL; stream->size = 0; @@ -324,7 +324,7 @@ FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not `mmap' file `%s'\n", filepathname )); - stream->base = (unsigned char*)ft_alloc( NULL, stream->size ); + stream->base = (unsigned char*)ft_alloc( stream->memory, stream->size ); if ( !stream->base ) { @@ -374,7 +374,7 @@ return FT_Err_Ok; Fail_Read: - ft_free( NULL, stream->base ); + ft_free( stream->memory, stream->base ); Fail_Map: close( file ); diff --git a/builds/windows/ftsystem.c b/builds/windows/ftsystem.c index bab7b31d3..1ebadd49f 100644 --- a/builds/windows/ftsystem.c +++ b/builds/windows/ftsystem.c @@ -188,7 +188,7 @@ FT_CALLBACK_DEF( void ) ft_close_stream_by_free( FT_Stream stream ) { - ft_free( NULL, stream->descriptor.pointer ); + ft_free( stream->memory, stream->descriptor.pointer ); stream->descriptor.pointer = NULL; stream->size = 0; @@ -323,7 +323,7 @@ FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not `mmap' file `%s'\n", filepathname )); - stream->base = (unsigned char*)ft_alloc( NULL, stream->size ); + stream->base = (unsigned char*)ft_alloc( stream->memory, stream->size ); if ( !stream->base ) { @@ -369,7 +369,7 @@ return FT_Err_Ok; Fail_Read: - ft_free( NULL, stream->base ); + ft_free( stream->memory, stream->base ); Fail_Open: CloseHandle( file ); |