Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
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
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, Bing

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWR FUSS » string not freed in fread_pla...
Forum Rules | Mark all | Recent Posts

string not freed in fread_planet
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Feb 5, 2009, 2:55 pm   Last edited Feb 5, 2009, 3:02 pm by Samsa
Go to the top of the page
Go to the bottom of the page

Samsa
Fledgling
GroupMembers
Posts15
JoinedAug 29, 2008

In clans.c, fread_planet lines 399-411:

case 'S':
            if( !str_cmp( word, "Starsystem" ) )
            {
               planet->starsystem = starsystem_from_name( fread_string( fp ) );
               if( planet->starsystem )
               {
                  SPACE_DATA *starsystem = planet->starsystem;

                  LINK( planet, starsystem->first_planet, starsystem->last_planet, next_in_system, prev_in_system );
               }
               fMatch = TRUE;
            }
            break;


It seems that
planet->starsystem = starsystem_from_name( fread_string( fp ) );
read a string, but it's never freed.

The same problem appears a few lines before:

case 'G':
	    if ( !str_cmp( word, "GovernedBy" ) )
	    {
	     	planet->governed_by = get_clan ( fread_string(fp) );
                fMatch = TRUE;
	    }
	    break;
       
Post is unread #2 Feb 5, 2009, 3:42 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Yep, certainly looks like those should be redone to read the string into a temp variable and assign the starsystem using that instead. Calling fread_string in this manner allocates it in the hash but as you say it's never released.
       
Post is unread #3 Feb 8, 2009, 5:23 am
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

Not sure if you have the function, but if you have fread_flagstring, you can replace fread_string with fread_flagstring, then you wouldn't have to worry about allocating/freeing a temporary variable for the starsystem name.
       
Pages:<< prev 1 next >>