diff options
author | Inkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-11-07 15:39:10 +0000 |
---|---|---|
committer | Inkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-11-07 15:39:10 +0000 |
commit | b018da7c84b65ad022309ddf1d973baef2307144 (patch) | |
tree | 73e5bd56773d5955dfb8e357170866fe77424018 | |
parent | 752030de0bf089cb360cd8ccffeb7db278e2504c (diff) | |
download | hercules-b018da7c84b65ad022309ddf1d973baef2307144.tar.gz hercules-b018da7c84b65ad022309ddf1d973baef2307144.tar.bz2 hercules-b018da7c84b65ad022309ddf1d973baef2307144.tar.xz hercules-b018da7c84b65ad022309ddf1d973baef2307144.zip |
* Fixed possible memory leaks caused by invalid parameters of autobonus
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14130 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | src/map/script.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/map/script.c b/src/map/script.c index 70b049fd1..8883f3783 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6641,11 +6641,12 @@ BUILDIN_FUNC(autobonus) if( sd->state.script_parsed&sd->status.inventory[current_equip_item_index].equip ) return 0; - bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0); rate = script_getnum(st,3); dur = script_getnum(st,4); - - if( !bonus_script || !rate || !dur ) + if( !rate || !dur ) + return 0; + bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0); + if( !bonus_script ) return 0; if( script_hasdata(st,5) ) @@ -6683,11 +6684,12 @@ BUILDIN_FUNC(autobonus2) if( sd->state.script_parsed&sd->status.inventory[current_equip_item_index].equip ) return 0; - bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0); rate = script_getnum(st,3); dur = script_getnum(st,4); - - if( !bonus_script || !rate || !dur ) + if( !rate || !dur ) + return 0; + bonus_script = parse_script(script_getstr(st,2), "autobonus2 bonus", 0, 0); + if( !bonus_script ) return 0; if( script_hasdata(st,5) ) @@ -6724,12 +6726,13 @@ BUILDIN_FUNC(autobonus3) if( sd->state.script_parsed&sd->status.inventory[current_equip_item_index].equip ) return 0; - bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0); rate = script_getnum(st,3); dur = script_getnum(st,4); atk_type = ( script_isstring(st,5) ? skill_name2id(script_getstr(st,5)) : script_getnum(st,5) ); - - if( !bonus_script || !rate || !dur || !atk_type ) + if( !rate || !dur || !atk_type ) + return 0; + bonus_script = parse_script(script_getstr(st,2), "autobonus3 bonus", 0, 0); + if( !bonus_script ) return 0; if( script_hasdata(st,6) ) |