Fixed unaffect and 2 memory leaks --Rumble

This commit is contained in:
Rumble 2010-06-20 04:43:32 +00:00
parent b55af08002
commit 4b44a1a097
8 changed files with 36 additions and 8 deletions

View file

@ -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 {

View file

@ -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)

View file

@ -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--;
}
}

View file

@ -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);
}
}

View file

@ -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();

View file

@ -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);