Changeset 10039


Ignore:
Timestamp:
2005-06-09T17:30:47+12:00 (19 years ago)
Author:
mdewsnip
Message:

Tidied up memory usage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/gtiaction.cpp

    r10037 r10039  
    430430    }
    431431
     432    delete[] cgi_argument_name_cstr;
    432433    ++cgi_argument;
    433434  }
     
    442443  do_gti_submission(gti_arguments, submission_text, logout);
    443444  logout << "Done." << endl;
     445
     446  delete[] source_chunk_key_start_cstr;
     447  delete[] target_chunk_key_start_cstr;
    444448}
    445449
     
    559563  // Send the request to gti.pl and read the XML output
    560564  text_t gti_command = "perl -S " + filename_cat(gsdlhome, "bin", "script", "gti.pl") + " " + gti_arguments;
    561   FILE *gti_pipe = popen(gti_command.getcstr(), "r");
     565  char* gti_command_cstr = gti_command.getcstr();
     566  FILE *gti_pipe = popen(gti_command_cstr, "r");
     567  delete[] gti_command_cstr;
    562568  if (gti_pipe == NULL) {
    563569    logout << "Error: Could not open pipe for GTI command " << gti_command << endl;
     
    582588  char* gti_response_xml_text_cstr = gti_response_xml_text.getcstr();
    583589  int parse_status = XML_Parse(xml_parser, gti_response_xml_text_cstr, strlen(gti_response_xml_text_cstr), XML_TRUE);
     590  delete[] gti_response_xml_text_cstr;
    584591  if (parse_status == XML_STATUS_ERROR) {
    585592    logout << "Parse error " << XML_ErrorString(XML_GetErrorCode(xml_parser)) << " at line " << XML_GetCurrentLineNumber(xml_parser) << endl;
     
    587594  }
    588595
    589   free(gti_response_xml_text_cstr);
    590596  XML_ParserFree(xml_parser);
    591597
     
    600606  // Send the submission to gti.pl
    601607  text_t gti_command = "perl -S " + filename_cat(gsdlhome, "bin", "script", "gti.pl") + " " + gti_arguments;
    602   FILE *gti_pipe = popen(gti_command.getcstr(), "w");
     608  char* gti_command_cstr = gti_command.getcstr();
     609  FILE *gti_pipe = popen(gti_command_cstr, "w");
     610  delete[] gti_command_cstr;
    603611  if (gti_pipe == NULL) {
    604612    logout << "Error: Could not open pipe for GTI command " << gti_command << endl;
     
    609617  char* gti_submission_cstr = gti_submission.getcstr();
    610618  fwrite(gti_submission_cstr, 1, strlen(gti_submission_cstr), gti_pipe);
    611   free(gti_submission_cstr);
     619  delete[] gti_submission_cstr;
    612620
    613621  pclose(gti_pipe);
Note: See TracChangeset for help on using the changeset viewer.