IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3907


Ignore:
Timestamp:
May 12, 2005, 1:07:37 PM (21 years ago)
Author:
eugene
Message:

cleaning up memory leaks

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

Legend:

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

    r2598 r3907  
    4747    free (inlist.line[i]);
    4848  }
     49  free (inlist.line[i]); /* note that we always alloc one extra line */
    4950  free (inlist.line);
    5051  return (status);
  • trunk/Ohana/src/opihi/cmd.basic/memory.c

    r3905 r3907  
    1313    return (TRUE);
    1414  }
     15  if (!strncasecmp ("variables", argv[1], strlen(argv[1]))) {
     16    ListVariables ();
     17    return (TRUE);
     18  }
     19  if (!strncasecmp ("vectors", argv[1], strlen(argv[1]))) {
     20    ListVectors ();
     21    return (TRUE);
     22  }
     23  if (!strncasecmp ("buffers", argv[1], strlen(argv[1]))) {
     24    PrintBuffers (0);
     25    return (TRUE);
     26  }
     27  if (!strncasecmp ("macros", argv[1], strlen(argv[1]))) {
     28    ListMacros();
     29    return (TRUE);
     30  }
     31  if (!strncasecmp ("commands", argv[1], strlen(argv[1]))) {
     32    print_commands (stderr);
     33    return (TRUE);
     34  }
    1535
    1636usage:
  • trunk/Ohana/src/opihi/cmd.basic/run_for.c

    r3337 r3907  
    5151      }
    5252    }
     53    if (ThisList == 0) ohana_memregister (input);
    5354
    5455    /* test for new macro (or other list, in the future?) */
  • trunk/Ohana/src/opihi/cmd.basic/run_if.c

    r2843 r3907  
    6161      input = strcreate ("end");
    6262    }
     63    if (ThisList == 0) ohana_memregister (input);
    6364
    6465    stripwhite (input);
  • trunk/Ohana/src/opihi/cmd.basic/run_while.c

    r2598 r3907  
    4848      }
    4949    }
     50    if (ThisList == 0) ohana_memregister (input);
    5051
    5152    /* test for new macro (or other list, in the future?) */
  • trunk/Ohana/src/opihi/lib.shell/MacroOps.c

    r2598 r3907  
    5656  }
    5757  return;
     58}
     59
     60void ListMacros () {
     61  int i;
     62  for (i = 0; i < Nmacros; i++) {
     63    fprintf (stderr, "%s\n", macros[i].name);
     64  }
    5865}
    5966
  • trunk/Ohana/src/opihi/lib.shell/macro_create.c

    r2598 r3907  
    4646    AddCommand (cmd);
    4747    free (cmd);
    48 
    4948    macro = NewMacro (argv[1]);
    5049  } else { /**** Old Macro ****/
     
    5857  NLINES = D_NLINES;
    5958  for (i = 0; i < macro[0].Nlines; i++) free (macro[0].line[i]);
    60   ALLOCATE (macro[0].line, char *, NLINES);
     59  REALLOCATE (macro[0].line, char *, NLINES);
    6160
    6261  /* read in macro
     
    7978      continue;
    8079    }
     80    if (ThisList == 0) ohana_memregister (input);
    8181
    8282    if ((ThisList > 0) && (input == (char *) NULL)) {
     
    9696        free (input);
    9797        macro[0].Nlines = i;
    98         if (macro[0].Nlines == 0)
    99           i = 1;
     98        if (macro[0].Nlines == 0) i = 1;
    10099        REALLOCATE (macro[0].line, char *, i);
    101100        return (TRUE);
  • trunk/Ohana/src/opihi/lib.shell/opihi.c

    r3905 r3907  
    4343      add_history (line);
    4444      append_history (1, history);
    45       free (line);
    4645      free (list);
    4746    }
     47    free (line);
    4848    line = (char *) NULL;
    4949  }
  • trunk/Ohana/src/opihi/pantasks/task.c

    r2598 r3907  
    5858      input = strcreate ("end");
    5959    }
     60    if (ThisList == 0) ohana_memregister (input);
    6061
    6162    stripwhite (input);
  • trunk/Ohana/src/opihi/pantasks/task_macros.c

    r2598 r3907  
    126126      input = strcreate ("end");
    127127    }
     128    if (ThisList == 0) ohana_memregister (input);
    128129
    129130    stripwhite (input);
Note: See TracChangeset for help on using the changeset viewer.