remove all instances of tfree.
Code is working, but full of memory leaks.
This commit is contained in:
parent
f9c956ff6b
commit
ccb7fa410b
|
|
@ -175,8 +175,6 @@ MIF_INP2A (
|
||||||
Mif_Status_t status; /* return status */
|
Mif_Status_t status; /* return status */
|
||||||
Mif_Token_Type_t next_token_type; /* the type of the next token */
|
Mif_Token_Type_t next_token_type; /* the type of the next token */
|
||||||
|
|
||||||
bool port_deleted = FALSE;
|
|
||||||
|
|
||||||
#ifdef TRACE
|
#ifdef TRACE
|
||||||
/* SDB debug statement */
|
/* SDB debug statement */
|
||||||
printf("In MIF_INP2A, line to process = %s . . . \n", current->line);
|
printf("In MIF_INP2A, line to process = %s . . . \n", current->line);
|
||||||
|
|
@ -192,8 +190,6 @@ MIF_INP2A (
|
||||||
|
|
||||||
/* locate the last token on the line (i.e. model name) and put it into "model" */
|
/* locate the last token on the line (i.e. model name) and put it into "model" */
|
||||||
while(*line != '\0') {
|
while(*line != '\0') {
|
||||||
if (model)
|
|
||||||
tfree(model);
|
|
||||||
model = MIFgettok(&line);
|
model = MIFgettok(&line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -324,9 +320,7 @@ MIF_INP2A (
|
||||||
fast[0]->conn[i]->size = 0;
|
fast[0]->conn[i]->size = 0;
|
||||||
|
|
||||||
/* eat the null token and continue to next connection */
|
/* eat the null token and continue to next connection */
|
||||||
tfree(next_token);
|
|
||||||
next_token = MIFget_token(&line,&next_token_type);
|
next_token = MIFget_token(&line,&next_token_type);
|
||||||
tfree(def_port_type_str);
|
|
||||||
continue; /* iterate */
|
continue; /* iterate */
|
||||||
} else {
|
} else {
|
||||||
/* set the null flag to false */
|
/* set the null flag to false */
|
||||||
|
|
@ -370,7 +364,7 @@ MIF_INP2A (
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fast[0]->conn[i]->size = 1;
|
fast[0]->conn[i]->size = 1;
|
||||||
tfree(def_port_type_str);
|
|
||||||
/* when we leave here, next_token should hold the next, unprocessed netname */
|
/* when we leave here, next_token should hold the next, unprocessed netname */
|
||||||
|
|
||||||
} else { /* ====== the connection is an array - much to be done ... ====== */
|
} else { /* ====== the connection is an array - much to be done ... ====== */
|
||||||
|
|
@ -381,8 +375,6 @@ MIF_INP2A (
|
||||||
printf("Missing [, an array connection was expected. Returning . . .");
|
printf("Missing [, an array connection was expected. Returning . . .");
|
||||||
return;
|
return;
|
||||||
} else /* eat the [ */
|
} else /* eat the [ */
|
||||||
if (next_token)
|
|
||||||
tfree(next_token);
|
|
||||||
next_token = MIFget_token(&line,&next_token_type);
|
next_token = MIFget_token(&line,&next_token_type);
|
||||||
|
|
||||||
/*------ get and process ports until ] is encountered ------*/
|
/*------ get and process ports until ] is encountered ------*/
|
||||||
|
|
@ -390,7 +382,6 @@ MIF_INP2A (
|
||||||
(next_token_type != MIF_RARRAY_TOK) &&
|
(next_token_type != MIF_RARRAY_TOK) &&
|
||||||
(*line != '\0');
|
(*line != '\0');
|
||||||
j++) {
|
j++) {
|
||||||
char* dpts_free = NULL;
|
|
||||||
/********** mhx Friday, August 19, 2011, 15:08 begin ***
|
/********** mhx Friday, August 19, 2011, 15:08 begin ***
|
||||||
Now if we had a % token, get actual info about connection type,
|
Now if we had a % token, get actual info about connection type,
|
||||||
or else use the port type for this connection that was setup BEFORE the '[' token.
|
or else use the port type for this connection that was setup BEFORE the '[' token.
|
||||||
|
|
@ -409,8 +400,6 @@ MIF_INP2A (
|
||||||
&status);
|
&status);
|
||||||
if(status == MIF_ERROR)
|
if(status == MIF_ERROR)
|
||||||
return;
|
return;
|
||||||
/*prepare to free def_port_type_str only if it has been set here */
|
|
||||||
dpts_free = def_port_type_str;
|
|
||||||
}
|
}
|
||||||
/* At this point, next_token should be either a [ or ] char (not allowed),
|
/* At this point, next_token should be either a [ or ] char (not allowed),
|
||||||
or hold a non-null connection (netname) */
|
or hold a non-null connection (netname) */
|
||||||
|
|
@ -448,10 +437,6 @@ MIF_INP2A (
|
||||||
j, /* port index */
|
j, /* port index */
|
||||||
&status);
|
&status);
|
||||||
|
|
||||||
if (dpts_free) {
|
|
||||||
tfree(dpts_free);
|
|
||||||
port_deleted = TRUE;
|
|
||||||
}
|
|
||||||
if(status == MIF_ERROR)
|
if(status == MIF_ERROR)
|
||||||
return;
|
return;
|
||||||
} /*------ end of for loop until ] is encountered ------*/
|
} /*------ end of for loop until ] is encountered ------*/
|
||||||
|
|
@ -478,16 +463,12 @@ MIF_INP2A (
|
||||||
We'll do that now, since when we enter the loop, we expect next_token
|
We'll do that now, since when we enter the loop, we expect next_token
|
||||||
to hold the next unprocessed token.
|
to hold the next unprocessed token.
|
||||||
*/
|
*/
|
||||||
if (next_token)
|
|
||||||
tfree(next_token);
|
|
||||||
next_token = MIFget_token(&line, &next_token_type);
|
next_token = MIFget_token(&line, &next_token_type);
|
||||||
|
|
||||||
} /* ====== array connection processing ====== */
|
} /* ====== array connection processing ====== */
|
||||||
|
|
||||||
/* be careful about putting stuff here, there is a 'continue' used */
|
/* be careful about putting stuff here, there is a 'continue' used */
|
||||||
/* in the processing of NULL connections above */
|
/* in the processing of NULL connections above */
|
||||||
if (!port_deleted && def_port_type_str)
|
|
||||||
tfree(def_port_type_str);
|
|
||||||
/* At this point, next_token should hold the next unprocessed token. */
|
/* At this point, next_token should hold the next unprocessed token. */
|
||||||
|
|
||||||
} /******* for number of connections *******/
|
} /******* for number of connections *******/
|
||||||
|
|
@ -508,9 +489,6 @@ MIF_INP2A (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tfree(model);
|
|
||||||
tfree(next_token);
|
|
||||||
|
|
||||||
/* check connection constraints */
|
/* check connection constraints */
|
||||||
|
|
||||||
for(i = 0; i < DEVices[type]->DEVpublic.num_conn; i++) {
|
for(i = 0; i < DEVices[type]->DEVpublic.num_conn; i++) {
|
||||||
|
|
@ -833,7 +811,6 @@ MIFget_port(
|
||||||
fast->conn[conn_num]->port[port_num]->invert = MIF_TRUE;
|
fast->conn[conn_num]->port[port_num]->invert = MIF_TRUE;
|
||||||
|
|
||||||
/* eat the tilde and get the next token */
|
/* eat the tilde and get the next token */
|
||||||
tfree(*next_token);
|
|
||||||
*next_token = MIFget_token(line, next_token_type);
|
*next_token = MIFget_token(line, next_token_type);
|
||||||
if(**line == '\0') {
|
if(**line == '\0') {
|
||||||
LITERR("ERROR - Not enough ports");
|
LITERR("ERROR - Not enough ports");
|
||||||
|
|
@ -861,7 +838,6 @@ MIFget_port(
|
||||||
fast->conn[conn_num]->port[port_num]->input.rvalue = 0.0;
|
fast->conn[conn_num]->port[port_num]->input.rvalue = 0.0;
|
||||||
|
|
||||||
/* eat the null token and return */
|
/* eat the null token and return */
|
||||||
tfree(*next_token);
|
|
||||||
*next_token = MIFget_token(line, next_token_type);
|
*next_token = MIFget_token(line, next_token_type);
|
||||||
*status = MIF_OK;
|
*status = MIF_OK;
|
||||||
return;
|
return;
|
||||||
|
|
@ -929,8 +905,6 @@ MIFget_port(
|
||||||
*status = MIF_ERROR;
|
*status = MIF_ERROR;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* free just the digital ones, the other are still assigned by INPtermInsert */
|
|
||||||
tfree(*next_token);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -958,8 +932,6 @@ MIFget_port(
|
||||||
|
|
||||||
*node = '0'; // added by K.A. March 5th 2000
|
*node = '0'; // added by K.A. March 5th 2000
|
||||||
node[1] ='\0'; // added by K.A. March 5th 2000
|
node[1] ='\0'; // added by K.A. March 5th 2000
|
||||||
// node = "0"; // deleted by K.A. March 5th 2000, this is incorrect, it creates a new pointer
|
|
||||||
// that cause a crash in INPtermInsert()
|
|
||||||
|
|
||||||
INPtermInsert(ckt, &node, tab, neg_node);
|
INPtermInsert(ckt, &node, tab, neg_node);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue