mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
Merge pull request #568 from rsfbarreira/patch-1
Fix undefined behavior in FreeStackWinding
This commit is contained in:
commit
fe4fbe25a8
1 changed files with 8 additions and 9 deletions
|
@ -116,16 +116,15 @@ fixedWinding_t *AllocStackWinding( pstack_t *stack ){
|
||||||
void FreeStackWinding( fixedWinding_t *w, pstack_t *stack ){
|
void FreeStackWinding( fixedWinding_t *w, pstack_t *stack ){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = w - stack->windings;
|
for (i = 0; i < sizeof(stack->windings) / sizeof(stack->windings[0]); i++) {
|
||||||
|
if (w == &stack->windings[i]) {
|
||||||
if ( i < 0 || i > 2 ) {
|
if ( stack->freewindings[i] ) {
|
||||||
return; // not from local
|
Error( "FreeStackWinding: already free" );
|
||||||
|
}
|
||||||
|
stack->freewindings[i] = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( stack->freewindings[i] ) {
|
|
||||||
Error( "FreeStackWinding: allready free" );
|
|
||||||
}
|
|
||||||
stack->freewindings[i] = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue