From 4b44a1a097c37b74a6d2bfebf610a1243e342e73 Mon Sep 17 00:00:00 2001 From: Rumble Date: Sun, 20 Jun 2010 04:43:32 +0000 Subject: [PATCH] Fixed unaffect and 2 memory leaks --Rumble --- changelog | 6 ++++++ lib/misc/bugs | 10 +++++----- src/act.wizard.c | 2 +- src/comm.c | 2 ++ src/db.c | 1 - src/ibt.c | 14 ++++++++++++++ src/ibt.h | 2 +- src/redit.c | 7 +++++++ 8 files changed, 36 insertions(+), 8 deletions(-) diff --git a/changelog b/changelog index 1843f4b..6f5982b 100644 --- a/changelog +++ b/changelog @@ -35,10 +35,16 @@ export (QQ's a zone into a tarball) Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) (lots of major bugfixes too) @ +[Jun 20 2010] - Rumble + Fixed two memory leaks. (thanks Dio) [Jum 19 2010] - Fizban Changed Helpcheck from level 34 to level 32. [Jun 07 2010] - Fizban Enabled nohassled immortals to give cursed items to other players. +[Jun 18 2010] - Rumble + Fixed unaffect clearing ch affects and not vict. (thanks Drefs) +[May 24 2010] - Rumble + Fixed bug in redit copy duplicating people in room. (thanks Anderyu) [May 19 2010] - Rumble Gave Arne Troffaes proper credit for fixing Cygwin syslog rotation. [May 16 2010] - Rumble diff --git a/lib/misc/bugs b/lib/misc/bugs index 9d9c73f..946c58c 100644 --- a/lib/misc/bugs +++ b/lib/misc/bugs @@ -1,8 +1,8 @@ -Text test 5~ -Body test5 +Text stuck in a room with no exits~ +Body I'm stuck in a room, that I suspect was supposed to be a death trap, in the deep, dark forest. three huge poinsonous spiders attacked me but I didn't die and now I'm in a room with no exits. ~ -Name Rumble~ -Level 34 -Room 1204 +Name Stickley~ +Level 8 +Room 6131 Flags 0 0 0 0 End diff --git a/src/act.wizard.c b/src/act.wizard.c index b538e8e..7d1cf25 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -2341,7 +2341,7 @@ ACMD(do_wizutil) while (vict->affected) affect_remove(vict, vict->affected); for(taeller=0; taeller < AF_ARRAY_MAX; taeller++) - AFF_FLAGS(ch)[taeller] = 0; + AFF_FLAGS(vict)[taeller] = 0; send_to_char(vict, "There is a brief flash of light!\r\nYou feel slightly different.\r\n"); send_to_char(ch, "All spells removed.\r\n"); } else { diff --git a/src/comm.c b/src/comm.c index 1fdee89..fe7adc4 100644 --- a/src/comm.c +++ b/src/comm.c @@ -80,6 +80,7 @@ #include "spells.h" /* for affect_update */ #include "modify.h" #include "quest.h" +#include "ibt.h" /* for free_ibt_lists */ #ifndef INVALID_SOCKET #define INVALID_SOCKET (-1) @@ -365,6 +366,7 @@ int main(int argc, char **argv) free_invalid_list(); /* ban.c */ free_save_list(); /* genolc.c */ free_strings(&config_info, OASIS_CFG); /* oasis_delete.c */ + free_ibt_lists(); /* ibt.c */ } if (last_act_message) diff --git a/src/db.c b/src/db.c index fa2baad..78e5b05 100644 --- a/src/db.c +++ b/src/db.c @@ -1036,7 +1036,6 @@ void index_boot(int mode) /* Sort the help index. */ if (mode == DB_BOOT_HLP) { qsort(help_table, top_of_helpt, sizeof(struct help_index_element), hsort); - top_of_helpt--; } } diff --git a/src/ibt.c b/src/ibt.c index 8bef909..3ec226f 100755 --- a/src/ibt.c +++ b/src/ibt.c @@ -1019,3 +1019,17 @@ void ibtedit_string_cleanup(struct descriptor_data *d, int terminator) break; } } + +/*-------------------------------------------------------------------*/ +void free_ibt_lists() +{ + IBT_DATA *first_ibt, *last_ibt; + int mode; + + for( mode=0; mode <=2; mode++){ + first_ibt = get_first_ibt(mode); + last_ibt = get_last_ibt(mode); + free_ibt_list(first_ibt, last_ibt); + } +} + diff --git a/src/ibt.h b/src/ibt.h index 878c9a3..f6eafcb 100755 --- a/src/ibt.h +++ b/src/ibt.h @@ -96,4 +96,4 @@ void save_ibt_file(int mode); void load_ibt_file(int mode); void ibtedit_parse(struct descriptor_data *d, char *arg); void ibtedit_string_cleanup(struct descriptor_data *d, int terminator); - +void free_ibt_lists(); diff --git a/src/redit.c b/src/redit.c index e762307..ee7b28d 100644 --- a/src/redit.c +++ b/src/redit.c @@ -170,6 +170,13 @@ void redit_setup_existing(struct descriptor_data *d, int real_num) CREATE(room, struct room_data, 1); *room = world[real_num]; + + /* Make new room people list be empty. */ + /* Fixes bug where copying a room from within that room creates */ + /* an infinite loop when you next act() in the new room (goto?) */ + /* and you are your next_in_room -- anderyu (10-05-22) */ + room->people = NULL; + /* Allocate space for all strings. */ room->name = str_udup(world[real_num].name); room->description = str_udup(world[real_num].description);