fix memory corruption on 64-bit systems

This commit is contained in:
Eric House 2014-01-02 07:48:12 -08:00
parent abb8da44ba
commit 093a260f1d

View file

@ -562,12 +562,12 @@ DrawCtx*
cursesDrawCtxtMake( WINDOW* boardWin ) cursesDrawCtxtMake( WINDOW* boardWin )
{ {
CursesDrawCtx* dctx = malloc( sizeof(CursesDrawCtx) ); CursesDrawCtx* dctx = malloc( sizeof(CursesDrawCtx) );
short i; int ii;
dctx->vtable = malloc( sizeof(*(((CursesDrawCtx*)dctx)->vtable)) ); dctx->vtable = malloc( sizeof(*(((CursesDrawCtx*)dctx)->vtable)) );
for ( i = 0; i < sizeof(*dctx->vtable)/4; ++i ) { for ( ii = 0; ii < VSIZE(dctx->vtable); ++ii ) {
((void**)(dctx->vtable))[i] = draw_doNothing; ((void**)(dctx->vtable))[ii] = draw_doNothing;
} }
SET_VTABLE_ENTRY( dctx->vtable, draw_destroyCtxt, curses ); SET_VTABLE_ENTRY( dctx->vtable, draw_destroyCtxt, curses );