IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3922


Ignore:
Timestamp:
May 12, 2005, 10:09:10 PM (21 years ago)
Author:
eugene
Message:

cleaned up memory leaks

Location:
trunk/Ohana/src/opihi
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.basic/quit.c

    r3905 r3922  
    55  int state;
    66
     7  print_ncals ();
    78  cleanup ();
    89
     
    1213  }
    1314
    14   ohana_memdump (0);
    1515  exit (state);
    1616
  • trunk/Ohana/src/opihi/cmd.basic/run_if.c

    r3907 r3922  
    3232  if (val == NULL) return (FALSE);
    3333  logic = atof (val); /* warning: round-off error is a danger */
     34  free (val);
    3435
    3536  if (BreakOnTrue) {
  • trunk/Ohana/src/opihi/cmd.basic/run_while.c

    r3907 r3922  
    1818  if (val == NULL) return (FALSE);
    1919  logic = atof (val); /* warning: round-off error is a danger */
     20  free (val);
    2021 
    2122  NLINES = D_NLINES;
     
    8586    if (val == NULL) return (FALSE);
    8687    logic = atof (val); /* warning: round-off error is a danger */
     88    free (val);
    8789  } while (logic && !interrupt);
    8890  loop_continue = loop_break = FALSE;
  • trunk/Ohana/src/opihi/cmd.data/select.c

    r2598 r3922  
    3535 
    3636  DeleteVector (tvec);
     37  free (out);
    3738  return (TRUE);
    3839
     
    4142  DeleteVector (ovec);
    4243  DeleteNamedVector (out);
     44  free (out);
    4345  return (FALSE);
    4446}
  • trunk/Ohana/src/opihi/cmd.data/set.c

    r2598 r3922  
    2121    case 0:
    2222      set_str_variable (argv[1], out);
     23      free (out);
    2324      break;
    2425
     
    2627      if (!MoveNamedVector (argv[1], out)) {
    2728        DeleteNamedVector (out);
     29        free (out);
    2830        fprintf (stderr, "invalid output vector name\n");
    2931        return (FALSE);
    3032      }
     33      free (out);
    3134      break;
    3235 
     
    3437      if (!MoveNamedBuffer (argv[1], out)) {
    3538        DeleteNamedBuffer (out);
     39        free (out);
    3640        fprintf (stderr, "invalid output matrix name\n");
    3741        return (FALSE);
    3842      }
     43      free (out);
    3944      break;
    4045  }
  • trunk/Ohana/src/opihi/cmd.data/subset.c

    r3900 r3922  
    3939
    4040  DeleteVector (tvec);
     41  free (out);
    4142  return (TRUE);
    4243
     
    4546  DeleteVector (ovec);
    4647  DeleteNamedVector (out);
     48  free (out);
    4749  return (FALSE);
    4850}
  • trunk/Ohana/src/opihi/lib.shell/ListOps.c

    r2598 r3922  
    3939int is_for_loop (char *line) {
    4040
     41  int status;
    4142  char *comm;
    4243
    4344  comm = thisword (line);
    4445  if (comm == (char *) NULL) return (FALSE);
    45 
    46   if (strcmp (comm, "for")) {
    47     free (comm);
    48     return (FALSE);
    49   }
    50 
    51   return (TRUE);
    52 
     46 
     47  status = !strcmp (comm, "for");
     48  free (comm);
     49  return (status);
    5350}
    5451
    5552int is_macro_create (char *line) {
    5653
    57   int i, N;
     54  int i, N, status;
    5855  char *comm;
    5956  char *this_macro;
    6057
     58  comm = thisword (line);
     59  if (comm == (char *) NULL) return (FALSE);
    6160
    62   comm = thisword (line);
    63   if (comm == (char *) NULL)
    64     return (FALSE);
    65   if (strcmp (comm, "macro")) {
    66     free (comm);
    67     return (FALSE);
    68   }
     61  status = !strcmp (comm, "macro");
     62  free (comm);
     63  if (!status) return (FALSE);
    6964 
    7065  this_macro = thisword (nextword (line));
    7166
    72   if (this_macro == (char *)NULL) {
    73     return (FALSE);
    74   }
     67  if (this_macro == (char *)NULL) return (FALSE);
    7568
    7669  N = sizeof (in_macro) / sizeof (Command);
     
    10194  if (strcmp (comm, "if")) goto escape;
    10295
     96  /* if (cond) break does not define a complete block */
    10397  if ((temp != NULL) && !strcmp (temp, "break")) goto escape;
    10498
    105   free (comm);
     99  if (temp != NULL) free (temp);
     100  if (comm != NULL) free (comm);
    106101  return (TRUE);
    107102
     
    114109int is_loop (char *line) {
    115110
     111  int status;
    116112  char *comm;
    117113
     
    119115  if (comm == (char *) NULL) return (FALSE);
    120116
    121   if (strcmp (comm, "while")) {
    122     free (comm);
    123     return (FALSE);
    124   }
     117  status = !strcmp (comm, "while");
    125118  free (comm);
    126   return (TRUE);
     119  return (status);
    127120}
    128121
  • trunk/Ohana/src/opihi/lib.shell/expand_vars.c

    r2598 r3922  
    4444      if ((*V1 == '=') || !strcmp (V1, "++") || !strcmp (V1, "--")) {
    4545        *N = *L;
     46        free (V0);
    4647        continue;
    4748      }
  • trunk/Ohana/src/opihi/lib.shell/expand_vectors.c

    r2792 r3922  
    1919  if (L == NULL) {
    2020    free (newline);
     21    free (tmpline);
    2122    return (line);
    2223  }
     
    4546      if (val == NULL) goto dumpline; /* not a valid vector subscript */
    4647    }
     48    I = atoi (val);
     49    free (val);
     50
    4751    /* find vector name */
    4852    for (w = p - 1; (w >= line) && !whitespace(*w) && (isalnum(*w) || (*w == ':') || (*w == '_')); w--);
     
    5155    strncpy (tmpline, w, n);
    5256    tmpline[n] = 0;
    53     if ((vec = SelectVector (tmpline, OLDVECTOR, TRUE)) == NULL) {
    54       free (val);
    55       goto dumpline;
    56     }
     57    if ((vec = SelectVector (tmpline, OLDVECTOR, TRUE)) == NULL) goto dumpline;
     58
    5759    /* find vector element */
    58     I = atoi (val);
    59     free (val);
    6060    if (I >= vec[0].Nelements) {
    6161      fprintf (stderr, "vector subscript out of range\n");
Note: See TracChangeset for help on using the changeset viewer.