diff options
author | remoitnane <remoit(DOT)nane(AT)gmail(DOT)com> | 2010-08-14 00:44:58 -0700 |
---|---|---|
committer | remoitnane <remoit(DOT)nane(AT)gmail(DOT)com> | 2010-08-14 00:44:58 -0700 |
commit | 7d1050ac6dfb32e9375a20001d71d052148689e9 (patch) | |
tree | 5a3f8200de0a324ef7862f18a1dc9ba1b40ad40a /src/map | |
parent | 1e414e67dbaaa1f85b350a79a4a4422e58b03ab3 (diff) | |
download | tmwa-7d1050ac6dfb32e9375a20001d71d052148689e9.tar.gz tmwa-7d1050ac6dfb32e9375a20001d71d052148689e9.tar.bz2 tmwa-7d1050ac6dfb32e9375a20001d71d052148689e9.tar.xz tmwa-7d1050ac6dfb32e9375a20001d71d052148689e9.zip |
Eliminate a slow memory leak in the magic system
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/magic-interpreter-base.c | 3 | ||||
-rw-r--r-- | src/map/magic.c | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/map/magic-interpreter-base.c b/src/map/magic-interpreter-base.c index 0ece700..9d21832 100644 --- a/src/map/magic-interpreter-base.c +++ b/src/map/magic-interpreter-base.c @@ -191,8 +191,11 @@ env_t *spell_create_env (magic_conf_t * conf, spell_t * spell, } case SPELLARG_NONE: + free (param); break; + default: + free (param); fprintf (stderr, "Unexpected spellarg type %d\n", spell->spellarg_ty); } diff --git a/src/map/magic.c b/src/map/magic.c index 8e9c80e..572203f 100644 --- a/src/map/magic.c +++ b/src/map/magic.c @@ -131,6 +131,8 @@ int magic_message (character_t * caster, char *spell_, size_t spell_len) } return 1; } + else + free (parameter); return 0; /* Not a spell */ } |