memory leaks: code improved
This commit is contained in:
parent
e43430a669
commit
8a4b560324
|
|
@ -1,7 +1,8 @@
|
|||
2009-04-05 Holger Vogt
|
||||
* com_fft.c, inpcom.c, variable.c, variable.h, resource.c, cpitf.c,
|
||||
plotit.c:
|
||||
plotit.c, inpgtok.c:
|
||||
some more memory leaks removed
|
||||
spicenum.c: release of memory for dico->dyncategory corrected
|
||||
|
||||
2009-04-01 Dietmar Warning
|
||||
* frontend/resource.c, misc/misc_time.c: init of rusage structure to prevent
|
||||
|
|
|
|||
|
|
@ -212,7 +212,6 @@ static void
|
|||
modernizeex (char *s)
|
||||
/* old style expressions &(..) and &id --> new style with braces. */
|
||||
{
|
||||
// Strbig (Llen, t);
|
||||
int i, state, ls;
|
||||
char c, d;
|
||||
Strbig (dynLlen, t);
|
||||
|
|
@ -290,7 +289,6 @@ transform (tdico * dico, char *s, unsigned char nostripping, char *u)
|
|||
* 'B' netlist (or .model ?) line that had Braces killed
|
||||
*/
|
||||
{
|
||||
// Strbig (Llen, t);
|
||||
char category;
|
||||
int i, k, a, n;
|
||||
Strbig (dynLlen, t);
|
||||
|
|
@ -389,7 +387,6 @@ static tdico *dico = NULL;
|
|||
static void
|
||||
putlogfile (char c, int num, char *t)
|
||||
{
|
||||
// Strbig (Llen, u);
|
||||
Str (20, fname);
|
||||
Strbig (dynLlen, u);
|
||||
if (dologfile)
|
||||
|
|
@ -439,8 +436,6 @@ nupa_init (char *srcfile)
|
|||
dico->dyncategory[i] = '?';
|
||||
}
|
||||
|
||||
// sini (dico->srcfile, sizeof (dico->srcfile) - 4);
|
||||
|
||||
if (srcfile != NULL)
|
||||
scopy (dico->srcfile, srcfile);
|
||||
}
|
||||
|
|
@ -462,8 +457,9 @@ nupa_done (void)
|
|||
|
||||
for (i = dynmaxline ; i >= 0; i--) {
|
||||
dispose ((void *) dico->dynrefptr[i]);
|
||||
dispose ((void *) dico->dyncategory[i]);
|
||||
}
|
||||
dispose ((void *) dico->dynrefptr);
|
||||
dispose ((void *) dico->dyncategory);
|
||||
dispose ((void *) dico);
|
||||
dico = NULL;
|
||||
dispose ((void *) inst_dico);
|
||||
|
|
@ -622,8 +618,6 @@ nupa_copy (char *s, int linenum)
|
|||
- substitute placeholders for all {..} --> 10-digit numeric values.
|
||||
*/
|
||||
{
|
||||
// Strbig (Llen, u);
|
||||
// Strbig (Llen, keywd);
|
||||
char *t;
|
||||
int ls;
|
||||
char c, d;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ int INPgetTok(char **line, char **token, int gobble)
|
|||
{
|
||||
char *point;
|
||||
int signstate;
|
||||
int diffpoints;
|
||||
|
||||
/* scan along throwing away garbage characters until end of line
|
||||
or a separation char is found */
|
||||
|
|
@ -94,7 +95,17 @@ int INPgetTok(char **line, char **token, int gobble)
|
|||
|
||||
}
|
||||
|
||||
if (point == *line && *point) /* Weird items, 1 char */
|
||||
diffpoints = point - *line;
|
||||
if ((diffpoints < 1) && *point)
|
||||
diffpoints = 1; /* Weird items, 1 char */
|
||||
*token = (char *) tmalloc((1 + diffpoints)*sizeof(char));
|
||||
if (!*token)
|
||||
return (E_NOMEM);
|
||||
(void) strncpy(*token, *line, diffpoints);
|
||||
*(*token + diffpoints) = '\0';
|
||||
*line = point;
|
||||
/*
|
||||
if (point == *line && *point)
|
||||
point++;
|
||||
*token = (char *) MALLOC(1 + point - *line);
|
||||
if (!*token)
|
||||
|
|
@ -102,7 +113,7 @@ int INPgetTok(char **line, char **token, int gobble)
|
|||
(void) strncpy(*token, *line, point - *line);
|
||||
*(*token + (point - *line)) = '\0';
|
||||
*line = point;
|
||||
|
||||
*/
|
||||
/* gobble garbage to next token */
|
||||
for (; **line != '\0'; (*line)++) {
|
||||
if (**line == ' ')
|
||||
|
|
@ -139,6 +150,7 @@ int INPgetNetTok(char **line, char **token, int gobble)
|
|||
{
|
||||
char *point;
|
||||
int signstate;
|
||||
int diffpoints;
|
||||
|
||||
/* scan along throwing away garbage characters until end of line
|
||||
or a separation char is found */
|
||||
|
|
@ -181,7 +193,18 @@ int INPgetNetTok(char **line, char **token, int gobble)
|
|||
}
|
||||
|
||||
/* now copy found token into *token */
|
||||
if (point == *line && *point) /* Weird items, 1 char */
|
||||
diffpoints = point - *line;
|
||||
if ((diffpoints < 1) && *point)
|
||||
diffpoints = 1; /* Weird items, 1 char */
|
||||
*token = (char *) tmalloc((1 + diffpoints)*sizeof(char));
|
||||
if (!*token)
|
||||
return (E_NOMEM);
|
||||
(void) strncpy(*token, *line, diffpoints);
|
||||
*(*token + diffpoints) = '\0';
|
||||
*line = point;
|
||||
|
||||
/*
|
||||
if (point == *line && *point)
|
||||
point++;
|
||||
*token = (char *) MALLOC(1 + point - *line);
|
||||
if (!*token)
|
||||
|
|
@ -189,7 +212,7 @@ int INPgetNetTok(char **line, char **token, int gobble)
|
|||
(void) strncpy(*token, *line, point - *line);
|
||||
*(*token + (point - *line)) = '\0';
|
||||
*line = point;
|
||||
|
||||
*/
|
||||
/* gobble garbage to next token */
|
||||
for (; **line != '\0'; (*line)++) {
|
||||
if (**line == ' ')
|
||||
|
|
|
|||
Loading…
Reference in New Issue