Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yandex

Members: 0
Guests: 6
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
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,639
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 >>