found some small leaks with Purify

This commit is contained in:
ceriel 1993-01-18 15:10:01 +00:00
parent ba62ce0edc
commit 439ec389a0
5 changed files with 21 additions and 11 deletions

View file

@ -381,13 +381,6 @@ int2float(expp, tp)
int uns = exp->ex_type->tp_unsigned;
if (is_cp_cst(exp)) {
*expp = new_expr();
**expp = *exp;
/* sprint(buf+1, "%ld", (long)(exp->VL_VALUE));
/* buf[0] = '-';
*/
exp = *expp; /* ??? */
exp->ex_type = tp;
exp->ex_class = Float;
flt_arith2flt(exp->VL_VALUE, &(exp->FL_ARITH), uns);

View file

@ -203,8 +203,9 @@ ch3bin(expp, oper, expr)
where o1 == (*expp)->VL_VALUE;
and ((oper == AND) || (oper == OR))
*/
if ((oper == AND) == (ex->VL_VALUE != (arith)0))
if ((oper == AND) == (ex->VL_VALUE != (arith)0)) {
*expp = expr;
}
else {
ex->ex_flags |= expr->ex_flags;
free_expression(expr);
@ -260,8 +261,17 @@ ch3bin(expp, oper, expr)
#ifdef LINT
hwarning("condition in ?: expression is constant");
#endif /* LINT */
*expp = (*expp)->VL_VALUE ?
expr->OP_LEFT : expr->OP_RIGHT;
if ((*expp)->VL_VALUE) {
free_expression(*expp);
free_expression(expr->OP_RIGHT);
*expp = expr->OP_LEFT;
}
else {
free_expression(*expp);
free_expression(expr->OP_LEFT);
*expp = expr->OP_RIGHT;
}
free_expr(expr);
(*expp)->ex_flags |= EX_ILVALUE;
}
else {
@ -274,6 +284,7 @@ ch3bin(expp, oper, expr)
#ifdef LINT
hwarning("constant expression ignored");
#endif /* LINT */
free_expression(*expp);
*expp = expr;
}
else {

View file

@ -315,6 +315,7 @@ do_include()
if (!InsertFile(filenm, &inctable[tok==FILESPECIFIER],&result)){
lexerror("cannot open include file \"%s\"", filenm);
add_dependency(filenm);
free(filenm);
}
else {
add_dependency(result);
@ -329,6 +330,7 @@ do_include()
C_ms_std(FileName, N_BINCL, 0);
}
#endif /* DBSYMTAB */
if (result != filenm) free(filenm);
}
}
}

View file

@ -63,6 +63,7 @@ AtEoIT()
return 0;
}
extern char *source;
AtEoIF()
{
@ -80,5 +81,7 @@ AtEoIF()
IncludeLevel--;
#endif
#endif /* NOPP */
if (WorkingDir[0] != '\0') free(WorkingDir);
if (FileName != source) free(FileName);
return 0;
}

View file

@ -155,7 +155,7 @@ next_option: /* to allow combined one-char options */
int i;
register char *new = text;
if (++inc_total > inc_max) {
if (inc_total >= inc_max) {
inctable = (char **)
Realloc((char *)inctable,
(unsigned)((inc_max+=10)*sizeof(char *)));
@ -167,6 +167,7 @@ next_option: /* to allow combined one-char options */
inctable[i] = new;
new = tmp;
}
inc_total++;
}
else inctable[inc_pos] = 0;
break;