summaryrefslogtreecommitdiff
path: root/src/map/magic-stmt.c
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2010-01-19 20:33:25 +0100
committerJared Adams <jaxad0127@gmail.com>2010-01-19 18:39:39 +0000
commitea5866863cbdad80eb69351417018c6104c5f43b (patch)
treefae1aeadc4c7af1beda05dc41ac2e11a8b184020 /src/map/magic-stmt.c
parent67e82f1a0bc2a9078cfe11e0add190fa7cc4b891 (diff)
downloadtmwa-ea5866863cbdad80eb69351417018c6104c5f43b.tar.gz
tmwa-ea5866863cbdad80eb69351417018c6104c5f43b.tar.bz2
tmwa-ea5866863cbdad80eb69351417018c6104c5f43b.tar.xz
tmwa-ea5866863cbdad80eb69351417018c6104c5f43b.zip
fixed a few memory leaks
Diffstat (limited to 'src/map/magic-stmt.c')
-rw-r--r--src/map/magic-stmt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/map/magic-stmt.c b/src/map/magic-stmt.c
index 1a1ced7..93ef65f 100644
--- a/src/map/magic-stmt.c
+++ b/src/map/magic-stmt.c
@@ -1161,7 +1161,7 @@ static effect_t *run_foreach (invocation_t * invocation, effect_t * foreach,
cont_activation_record_t *ar =
add_stack_entry (invocation, CONT_STACK_FOREACH, return_location);
int entities_allocd = 64;
- int *entities_collect = malloc (entities_allocd * sizeof (int));
+ int *entities_collect;
int *entities;
int *shuffle_board;
int entities_nr = 0;
@@ -1170,6 +1170,8 @@ static effect_t *run_foreach (invocation_t * invocation, effect_t * foreach,
if (!ar)
return return_location;
+ entities_collect = malloc (entities_allocd * sizeof (int));
+
find_entities_in_area (area.v.v_area, &entities_allocd, &entities_nr,
&entities_collect, filter);