From 00622428bda8d7521db8d74260b519fa41d69d0a Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 18 Jan 2019 10:10:43 +0000 Subject: [PATCH] zero memory on malloc to prevent write of uninit memory under some error conditions thanks Balint --- ChangeLog | 5 ++++- libvips/iofuncs/memory.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e80313a8..057adf95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 4/1/19 started 8.7.4 -- magicksave with magick6 API did not chain exceptions correctly [kleisauke] +- magicksave with magick6 API did not chain exceptions correctly causing a + memory leak under some conditions [kleisauke] +- zero memory on allocate to prevent write of uninitialized memory under some + error conditions [Balint Varga-Perke] 21/11/18 started 8.7.3 - fix infinite loop for autofit with non-scaleable font diff --git a/libvips/iofuncs/memory.c b/libvips/iofuncs/memory.c index d877e2e0..9f9b55f8 100644 --- a/libvips/iofuncs/memory.c +++ b/libvips/iofuncs/memory.c @@ -173,7 +173,7 @@ vips_malloc( VipsObject *object, size_t size ) { void *buf; - buf = g_malloc( size ); + buf = g_malloc0( size ); if( object ) { g_signal_connect( object, "postclose", @@ -317,7 +317,7 @@ vips_tracked_malloc( size_t size ) */ size += 16; - if( !(buf = g_try_malloc( size )) ) { + if( !(buf = g_try_malloc0( size )) ) { #ifdef DEBUG g_assert_not_reached(); #endif /*DEBUG*/