aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.c
diff options
context:
space:
mode:
authorBenoit Germain <bnt period germain arrobase gmail period com>2014-03-17 09:35:05 +0100
committerBenoit Germain <bnt period germain arrobase gmail period com>2014-03-17 09:35:05 +0100
commit0ffafefaf5ef410fa0da95ac1860e817428531ed (patch)
treed1cadd12607a3915509dfe3bec0331dfca388820 /src/keeper.c
parent9e55f96ac685929a11681b9c98710c94eeb2e18a (diff)
downloadlanes-0ffafefaf5ef410fa0da95ac1860e817428531ed.tar.gz
lanes-0ffafefaf5ef410fa0da95ac1860e817428531ed.tar.bz2
lanes-0ffafefaf5ef410fa0da95ac1860e817428531ed.zip
Fixed crash when using protect_allocator option
Diffstat (limited to 'src/keeper.c')
-rw-r--r--src/keeper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/keeper.c b/src/keeper.c
index 7362ca6..4d2d068 100644
--- a/src/keeper.c
+++ b/src/keeper.c
@@ -612,7 +612,7 @@ void close_keepers( struct s_Universe* U, lua_State* L)
612 { 612 {
613 void* allocUD; 613 void* allocUD;
614 lua_Alloc allocF = lua_getallocf( L, &allocUD); 614 lua_Alloc allocF = lua_getallocf( L, &allocUD);
615 allocF( L, U->keepers, sizeof( struct s_Keepers) + (nbKeepers - 1) * sizeof(struct s_Keeper), 0); 615 allocF( allocUD, U->keepers, sizeof( struct s_Keepers) + (nbKeepers - 1) * sizeof(struct s_Keeper), 0);
616 U->keepers = NULL; 616 U->keepers = NULL;
617 } 617 }
618 } 618 }
@@ -645,7 +645,7 @@ void init_keepers( struct s_Universe* U, lua_State* L)
645 // struct s_Keepers contains an array of 1 s_Keeper, adjust for the actual number of keeper states 645 // struct s_Keepers contains an array of 1 s_Keeper, adjust for the actual number of keeper states
646 { 646 {
647 size_t const bytes = sizeof( struct s_Keepers) + (nb_keepers - 1) * sizeof(struct s_Keeper); 647 size_t const bytes = sizeof( struct s_Keepers) + (nb_keepers - 1) * sizeof(struct s_Keeper);
648 U->keepers = (struct s_Keepers*) allocF( L, NULL, 0, bytes); 648 U->keepers = (struct s_Keepers*) allocF( allocUD, NULL, 0, bytes);
649 if( U->keepers == NULL) 649 if( U->keepers == NULL)
650 { 650 {
651 (void) luaL_error( L, "init_keepers() failed while creating keeper array; out of memory"); 651 (void) luaL_error( L, "init_keepers() failed while creating keeper array; out of memory");