mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
fix short alloc and heap corruption for winding_accu_t and brush_t - brought about by https://github.com/TTimo/bspc/pull/4
This commit is contained in:
parent
b36b3ba4b6
commit
a88ef20680
2 changed files with 2 additions and 7 deletions
|
@ -94,7 +94,7 @@ winding_accu_t *AllocWindingAccu( int points ){
|
|||
c_peak_windings = c_active_windings;
|
||||
}
|
||||
}
|
||||
s = sizeof( vec_accu_t ) * 3 * points + sizeof( int );
|
||||
s = sizeof(*w) + (points > 4 ? sizeof(vec3_accu_t) * (points - 4) : 0);
|
||||
w = safe_malloc( s );
|
||||
memset( w, 0, s );
|
||||
return w;
|
||||
|
|
|
@ -93,12 +93,7 @@ brush_t *AllocBrush( int numSides ){
|
|||
brush_t *bb;
|
||||
size_t c;
|
||||
|
||||
|
||||
/* allocate and clear */
|
||||
if ( numSides <= 0 ) {
|
||||
Error( "AllocBrush called with numsides = %d", numSides );
|
||||
}
|
||||
c = (size_t)&( ( (brush_t*) 0 )->sides[ numSides ] );
|
||||
c = sizeof(*bb) + (numSides > 6 ? sizeof(side_t)*(numSides - 6) : 0);
|
||||
bb = safe_malloc( c );
|
||||
memset( bb, 0, c );
|
||||
if ( numthreads == 1 ) {
|
||||
|
|
Loading…
Reference in a new issue