IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42938


Ignore:
Timestamp:
Nov 12, 2025, 4:47:51 PM (6 months ago)
Author:
eugene
Message:

free memory on exit

Location:
trunk/Ohana/src/opihi/lib.shell
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.shell/ConfigInit.c

    r38986 r42938  
    2222}
    2323
    24 // this function is only called at shutdown, so it is not thread protect
     24// this function is only called at shutdown, so it is not thread safe
    2525void ConfigFree () {
    2626  if (GlobalConfig) free (GlobalConfig);
     27  FreeConfigFile (); // frees the config variable structures
    2728  return;
    2829}
  • trunk/Ohana/src/opihi/lib.shell/command.c

    r30614 r42938  
    3636  /* solve math expresions, assign variable, if needed.  any entry in line of the form {foo}
    3737   * returns value or tmp vector / buffer */
    38   line = parse (&status, line);        /* line is freed here, new one allocated */
     38  line = parse (&status, line);
     39  /* NOTE: line is freed here, new one allocated.  This is NOT freed by the 'quit' command */
    3940  if (!status) goto escape;
    4041
     
    4243  *outline = line;
    4344 
     45  // this value is not freed by 'quit' (called as command below)
    4446  argv = parse_commands (line, &argc);
    4547  if (argc == 0) {
     
    5052
    5153  /* save the original values of argv since command may modify the array */
     54  // this value is not freed by 'quit' (called as command below)
    5255  ALLOCATE (targv, char *, argc);
    5356  for (i = 0; i < argc; i++) targv[i] = argv[i];
  • trunk/Ohana/src/opihi/lib.shell/gprint.c

    r41483 r42938  
    9393
    9494  pthread_mutex_unlock (&init_stream_mutex);
     95}
     96
     97// call just before exiting opihi-based programs
     98void gprintFree () {
     99  for (int i = 0; i < Nstreams; i++) {
     100    FreeIOBuffer (streams[i][0].buffer);
     101    FREE (streams[i][0].buffer);
     102    FREE (streams[i][0].name);
     103    FREE (streams[i]);
     104  }
     105  FREE (streams);
     106  return;
    95107}
    96108
Note: See TracChangeset for help on using the changeset viewer.