@ -523,32 +523,35 @@ error:
return - 1 ;
}
static void SCACTileRealloc Stat e( SCACTileCtx * ctx , int new_state_count )
static void SCACTileRealloc OutputTabl e( SCACTileCtx * ctx , int new_state_count )
{
void * ptmp ;
int size = 0 ;
/* reallocate space in the goto table to include a new state */
size = ctx - > allocated_state_count * sizeof ( int32_t ) * 256 ;
ptmp = SCRealloc ( ctx - > goto _table, size ) ;
/* reallocate space in the output table for the new state */
size_t size = ctx - > allocated_state_count * sizeof ( SCACTileOutputTable ) ;
void * ptmp = SCRealloc ( ctx - > output _table, size ) ;
if ( ptmp = = NULL ) {
SCFree ( ctx - > goto _table) ;
ctx - > goto _table = NULL ;
SCFree ( ctx - > output _table) ;
ctx - > output _table = NULL ;
SCLogError ( SC_ERR_MEM_ALLOC , " Error allocating memory " ) ;
exit ( EXIT_FAILURE ) ;
}
ctx - > goto_table = ptmp ;
ctx - > output_table = ptmp ;
}
/* reallocate space in the output table for the new state */
size = ctx - > allocated_state_count * sizeof ( SCACTileOutputTable ) ;
ptmp = SCRealloc ( ctx - > output_table , size ) ;
static void SCACTileReallocState ( SCACTileCtx * ctx , int new_state_count )
{
/* reallocate space in the goto table to include a new state */
size_t size = ctx - > allocated_state_count * sizeof ( int32_t ) * 256 ;
void * ptmp = SCRealloc ( ctx - > goto_table , size ) ;
if ( ptmp = = NULL ) {
SCFree ( ctx - > output_table ) ;
ctx - > output _table = NULL ;
SCFree ( ctx - > goto _table) ;
ctx - > goto _table = NULL ;
SCLogError ( SC_ERR_MEM_ALLOC , " Error allocating memory " ) ;
exit ( EXIT_FAILURE ) ;
}
ctx - > output_table = ptmp ;
ctx - > goto_table = ptmp ;
SCACTileReallocOutputTable ( ctx , new_state_count ) ;
}
/**
@ -1133,7 +1136,7 @@ static void SCACTilePrepareSearch(MpmCtx *mpm_ctx)
SCACTileCtx * ctx = search_ctx - > init_ctx ;
/* Resize the output table to be only as big as its final size. */
SCACTileRealloc Stat e( ctx , ctx - > state_count ) ;
SCACTileRealloc OutputTabl e( ctx , ctx - > state_count ) ;
search_ctx - > search = ctx - > search ;
memcpy ( search_ctx - > translate_table , ctx - > translate_table , sizeof ( ctx - > translate_table ) ) ;