vis: use uintptr for FreeStackWinding index check
Just in case unsigned long isn't big enough to capture the pointer offsets. Also, cast STACK_WINDINGS to the correct type before doing the comparison. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
97371bc6ab
commit
d3a75f6c1a
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <vis/leafbits.h>
|
||||
#include <vis/vis.h>
|
||||
|
|
@ -213,12 +214,12 @@ AllocStackWinding(pstack_t *stack)
|
|||
void
|
||||
FreeStackWinding(winding_t *w, pstack_t *stack)
|
||||
{
|
||||
unsigned long i = w - stack->windings;
|
||||
uintptr_t index = w - stack->windings;
|
||||
|
||||
if (i < STACK_WINDINGS) {
|
||||
if (stack->freewindings[i])
|
||||
if (index < (uintptr_t)STACK_WINDINGS) {
|
||||
if (stack->freewindings[index])
|
||||
Error("%s: winding already freed", __func__);
|
||||
stack->freewindings[i] = 1;
|
||||
stack->freewindings[index] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue