IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16427


Ignore:
Timestamp:
Feb 13, 2008, 3:21:25 PM (18 years ago)
Author:
eugene
Message:

free input line, protect from ohana_memory if from readline

File:
1 edited

Legend:

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

    r13538 r16427  
    162162
    163163    /* get the next line (from correct place) */
    164     if (ThisList == 0)
     164    if (ThisList == 0) {
    165165      input = readline (prompt);
    166     else
     166    } else {
    167167      input = get_next_listentry (ThisList);
    168 
    169     if (input == (char *) NULL) {
    170       if (ThisList == 0)  {
    171         gprint (GP_ERR, "end list with 'END'\n");
    172         continue;
    173       } else {
    174         return (FALSE);
    175       }
    176     }
     168    }
     169
     170    if ((ThisList == 0) && (input == NULL)) {
     171      gprint (GP_ERR, "end list with 'END'\n");
     172      continue;
     173    }
     174    if ((ThisList >  0) && (input == NULL)) {
     175      gprint (GP_ERR, "missing 'END' in list\n");
     176      input = strcreate ("end");
     177    }
     178    if (ThisList == 0) ohana_memregister (input);
     179
    177180    stripwhite (input);
    178181
     
    191194      sprintf (line, "%s:%d", argv[1], i);
    192195      set_str_variable (line, input);
     196      free (input);
    193197      i++;
    194     }
     198   }
    195199  }
    196200  return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.