Browse Source

fix a memory leak in parse_line()

This has a HUGE affect on memory usage
Michael Woodworth 14 years ago
committed by rlar
parent
commit
3375e1b976
  1. 8
      src/spicelib/parser/inpgmod.c

8
src/spicelib/parser/inpgmod.c

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

Loading…
Cancel
Save