fix a memory leak in parse_line()

This has a HUGE affect on memory usage
This commit is contained in:
Michael Woodworth 2012-04-05 19:03:25 +02:00 committed by rlar
parent 8b780fa42b
commit 3375e1b976
1 changed files with 5 additions and 3 deletions

View File

@ -141,7 +141,7 @@ create_model( CKTcircuit* ckt, INPmodel* modtmp, INPtables* tab )
static bool
parse_line( char* line, char* tokens[], int num_tokens, double values[], bool found[] )
{
char* token;
char* token = NULL;
int get_index = -1;
int i;
bool flag = TRUE;
@ -157,12 +157,13 @@ parse_line( char* line, char* tokens[], int num_tokens, double values[], bool fo
found[get_index] = TRUE;
get_index = -1;
continue;
} else {
INPgetNetTok( &line, &token, 1 );
}
INPgetNetTok( &line, &token, 1 );
for ( i = 0; i < num_tokens; i++ )
if ( strcmp( tokens[i], token ) == 0 ) get_index = i;
txfree(token);
}
for ( i = 0; i < num_tokens; i++ )
@ -170,6 +171,7 @@ parse_line( char* line, char* tokens[], int num_tokens, double values[], bool fo
flag = FALSE;
break;
}
return flag;
}