found some small leaks with Purify
authorceriel <none@none>
Mon, 18 Jan 1993 15:10:01 +0000 (15:10 +0000)
committerceriel <none@none>
Mon, 18 Jan 1993 15:10:01 +0000 (15:10 +0000)
lang/cem/cemcom.ansi/arith.c
lang/cem/cemcom.ansi/ch3bin.c
lang/cem/cemcom.ansi/domacro.c
lang/cem/cemcom.ansi/input.c
lang/cem/cemcom.ansi/options.c

index 9ade7d5..9190c08 100644 (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);
index 6779f15..0d0a01c 100644 (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 {
index de6768f..6a5f0b5 100644 (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);
                }
        }
 }
index b6e9a44..d459096 100644 (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;
 }
index 4585218..bbb9318 100644 (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;