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, dbnu, DotBot, Google

Members: 1
Guests: 7
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 » SmaugFUSS Bugfix List » [Bug] Memory leak in load_rac...
Forum Rules | Mark all | Recent Posts

[Bug] Memory leak in load_race_file
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Nov 5, 2005, 8:05 pm
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 load_race_file
Danger: Medium - Only leaks memory during boot
Found by: Remcon
Fixed by: Remcon

---

tables.c, load_race_file

Locate:
               fclose( fp );
               if( ra < 0 || ra >= MAX_RACE )
               {
                  bug( "Load_race_file: Race (%s) bad/not found (%d)",
                       race->race_name ? race->race_name : "name not found", ra );
                  if( race_name )
                     STRFREE( race_name );
                  DISPOSE( race );
                  return FALSE;
               }


Change to:
               fclose( fp );
               fp = NULL;
               if( ra < 0 || ra >= MAX_RACE )
               {
                  bug( "Load_race_file: Race (%s) bad/not found (%d)",
                       race->race_name ? race->race_name : "name not found", ra );
                  STRFREE( race_name );
                  for( i = 0; i < MAX_WHERE_NAME; ++i )
                     DISPOSE( race->where_name[i] );
                  DISPOSE( race );
                  return FALSE;
               }


Locate:
               else if( wear < MAX_WHERE_NAME )
               {
                  race->where_name[wear] = fread_string_nohash( fp );
                  ++wear;
               }


Change to:
               else if( wear < MAX_WHERE_NAME )
               {
                  DISPOSE( race->where_name[wear] );
                  race->where_name[wear] = fread_string_nohash( fp );
                  ++wear;
               }


Yet more memory leakage on the part of the code. One might think that after all this time all of these would be fixed. This leaves one less set of leaks to worry about. Fortunately it was only a small amount of memory leaked once during bootup.
       
Pages:<< prev 1 next >>