Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex, Sogou, Majestic-12

Members: 0
Guests: 3
Stats
Files
Topics
Posts
Members
Newest Member
481
3,734
19,366
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Memory leak in clean_ro...
Forum Rules | Mark all | Recent Posts

[Bug] Memory leak in clean_room - not clearing mudprog pointers
< Newer Topic :: Older Topic > AFKMud 1.64

Pages:<< prev 1 next >>
Post is unread #1 Feb 5, 2005, 6:51 pm   Last edited Nov 13, 2005, 11:55 am by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Bug: Memory leak in clean_room - not clearing mudprog pointers
Discovered in: AFKMud 1.64
Danger: Medium - Memory leak
Found by: Samson
Fixed by: Samson

---

handler.c, locate:

void clean_room( ROOM_INDEX_DATA *room )
{
   EXTRA_DESCR_DATA     *ed, *ed_next;
   EXIT_DATA            *pexit, *pexit_next;

   DISPOSE( room->roomdesc );
   DISPOSE( room->nitedesc );
   STRFREE( room->name );
   for ( ed = room->first_extradesc; ed; ed = ed_next )
   {
        ed_next = ed->next;
        STRFREE( ed->extradesc );
        STRFREE( ed->keyword );
        DISPOSE( ed );
        top_ed--;
   }
   room->first_extradesc        = NULL;
   room->last_extradesc         = NULL;
   for ( pexit = room->first_exit; pexit; pexit = pexit_next )
   {
        pexit_next = pexit->next;
      extract_exit( room, pexit );
        top_exit--;
   }
   room->first_exit = NULL;
   room->last_exit = NULL;
   xCLEAR_BITS( room->room_flags );
   room->sector_type = 0;
   room->light = 0;
}


Replace with:

void clean_room( ROOM_INDEX_DATA *room )
{
   EXTRA_DESCR_DATA     *ed, *ed_next;
   EXIT_DATA            *pexit, *pexit_next;
   MPROG_DATA *mprog, *mprog_next;

   DISPOSE( room->roomdesc );
   DISPOSE( room->nitedesc );
   STRFREE( room->name );
   for( mprog = room->mudprogs; mprog; mprog = mprog_next )
        {
            mprog_next = mprog->next;
            STRFREE( mprog->arglist );
            STRFREE( mprog->comlist );
            DISPOSE( mprog );
        }
   for ( ed = room->first_extradesc; ed; ed = ed_next )
   {
        ed_next = ed->next;
        STRFREE( ed->extradesc );
        STRFREE( ed->keyword );
        DISPOSE( ed );
        top_ed--;
   }
   room->first_extradesc        = NULL;
   room->last_extradesc         = NULL;
   for ( pexit = room->first_exit; pexit; pexit = pexit_next )
   {
        pexit_next = pexit->next;
      extract_exit( room, pexit );
        top_exit--;
   }
   room->first_exit = NULL;
   room->last_exit = NULL;
   xCLEAR_BITS( room->room_flags );
   room->sector_type = 0;
   room->light = 0;
}


The function clean_room is meant to do just that, clean the room index of any lingering data. This should have included the mudprog lists but didn't. Failure to clean these lists will result in a memory leak and will cause what should be a clean room to retain any programs it once had.

This bug also affects various Smaug releases.
       
Pages:<< prev 1 next >>