2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 12:22:17 +00:00

Fix memory leak

If vsnprintf returns -1 then the buffer should be freed before returning.
This commit is contained in:
Jonathan Wakely
2018-10-10 17:17:10 +01:00
committed by GitHub
parent 0039408568
commit 8ff11a8ecc

View File

@@ -860,10 +860,11 @@ static const char * debug_format_message( const char * format, va_list vargs )
result = vsnprintf( buf, sz, format, args );
#endif
va_end( args );
if ( 0 <= result && result < sz )
return buf;
free( buf );
if ( result < 0 )
return 0;
if ( result < sz ) return buf;
free( buf );
sz = result + 1;
}
}