This patch should take care of the "delete of something allocated with new[]"
part of http://opendx.watson.ibm.com/dx/mailArchives/mails.html/opendx-dev.0310/msg00005.html Regards, Marco Morandini
Index: src/uipp/base/Command.C =================================================================== RCS file: /src/master/dx/src/uipp/base/Command.C,v retrieving revision 1.8 diff -u -r1.8 Command.C --- src/uipp/base/Command.C 30 Sep 2003 17:41:46 -0000 1.8 +++ src/uipp/base/Command.C 9 Dec 2003 10:28:53 -0000 @@ -93,7 +93,7 @@ for (i=0 ; i<autos ; i++) cmds[i]->removeAutoCmd(this); - delete cmds; + delete[] cmds; } autos = this->activateCmds.getSize(); @@ -111,7 +111,7 @@ for (i=0 ; i<autos ; i++) this->removeAutoCmd(cmds[i]); - delete cmds; + delete[] cmds; } autos = this->deactivateCmds.getSize(); if (autos > 0) { @@ -128,7 +128,7 @@ for (i=0 ; i<autos ; i++) this->removeAutoCmd(cmds[i]); - delete cmds; + delete[] cmds; } delete[] this->name; Index: src/uipp/base/IBMApplication.C =================================================================== RCS file: /src/master/dx/src/uipp/base/IBMApplication.C,v retrieving revision 1.23 diff -u -r1.23 IBMApplication.C --- src/uipp/base/IBMApplication.C 30 Sep 2003 17:41:46 -0000 1.23 +++ src/uipp/base/IBMApplication.C 9 Dec 2003 10:28:55 -0000 @@ -229,15 +229,15 @@ if (this->helpWindow) delete this->helpWindow; if (this->aboutAppString) - delete this->aboutAppString; + delete[] this->aboutAppString; if (this->techSupportString) - delete this->techSupportString; + delete[] this->techSupportString; if (this->noWizards) { ListIterator it(*this->noWizards); char *nowiz; while ( (nowiz = (char*)it.getNext()) ) - delete nowiz; + delete[] nowiz; delete this->noWizards; this->noWizards = NUL(List*); } @@ -1087,7 +1087,7 @@ XrmPutLineResource (&db, resource_line); XrmPutFileDatabase (db, res_file); XrmDestroyDatabase(db); - delete resource_line; + delete[] resource_line; } boolean IBMApplication::isWizardWindow(const char* name) Index: src/uipp/base/MainWindow.C =================================================================== RCS file: /src/master/dx/src/uipp/base/MainWindow.C,v retrieving revision 1.13 diff -u -r1.13 MainWindow.C --- src/uipp/base/MainWindow.C 30 Sep 2003 17:41:46 -0000 1.13 +++ src/uipp/base/MainWindow.C 9 Dec 2003 10:28:57 -0000 @@ -129,13 +129,13 @@ ASSERT(theApplication); theApplication->unregisterClient(this); - if (this->title) delete this->title; + if (this->title) delete[] this->title; if (this->hasMenuBar && this->commandScope) delete this->commandScope; if (this->geometry_string) - delete this->geometry_string; + delete[] this->geometry_string; } // @@ -519,7 +519,7 @@ else if (!EqualString(this->title, name)) { if(this->title) - delete this->title; + delete[] this->title; this->title = DuplicateString(name); } else { titles_equal = TRUE; @@ -539,9 +539,9 @@ this->setGeometry(x,y,w,h); } if (old_geom_string) - delete old_geom_string; + delete[] old_geom_string; } else if (this->geometry_string) { - delete this->geometry_string; + delete[] this->geometry_string; this->geometry_string = NUL(char*); } } Index: src/uipp/base/Strings.C =================================================================== RCS file: /src/master/dx/src/uipp/base/Strings.C,v retrieving revision 1.14 diff -u -r1.14 Strings.C --- src/uipp/base/Strings.C 30 Sep 2003 17:41:46 -0000 1.14 +++ src/uipp/base/Strings.C 9 Dec 2003 10:28:57 -0000 @@ -127,15 +127,15 @@ unique = new char[strlen(path) + 12]; strcpy(unique, path); strcat(unique,"/tmpXXXXXX"); - delete path; + delete[] path; } else { if (path) - delete path; + delete[] path; unique = DuplicateString("tmpXXXXXX"); } if (!mktemp(unique)) { - delete unique; + delete[] unique; unique = NULL; } Index: src/uipp/base/UIComponent.C =================================================================== RCS file: /src/master/dx/src/uipp/base/UIComponent.C,v retrieving revision 1.10 diff -u -r1.10 UIComponent.C --- src/uipp/base/UIComponent.C 30 Sep 2003 17:41:47 -0000 1.10 +++ src/uipp/base/UIComponent.C 9 Dec 2003 10:28:58 -0000 @@ -132,10 +132,10 @@ delete[] this->name; if (this->help_msg) - delete this->help_msg; + delete[] this->help_msg; if (this->inactive_help_msg) - delete this->inactive_help_msg; + delete[] this->inactive_help_msg; } void UIComponent::clearRootWidget() @@ -168,12 +168,12 @@ void UIComponent::setBubbleHelp (const char *msg, Widget w, boolean active_help) { if (active_help) { - if (this->help_msg) delete this->help_msg; + if (this->help_msg) delete[] this->help_msg; this->help_msg = NUL(char*); if ((!msg) || (!msg[0])) return ; this->help_msg = DuplicateString(msg); } else { - if (this->inactive_help_msg) delete this->inactive_help_msg; + if (this->inactive_help_msg) delete[] this->inactive_help_msg; this->inactive_help_msg = NUL(char*); if ((!msg) || (!msg[0])) return ; this->inactive_help_msg = DuplicateString(msg); @@ -343,7 +343,7 @@ } this->active = TRUE; if (this->inactive_help_msg) { - delete this->inactive_help_msg; + delete[] this->inactive_help_msg; this->inactive_help_msg = NUL(char*); } } Index: src/uipp/dxui/MacroDefinition.C =================================================================== RCS file: /src/master/dx/src/uipp/dxui/MacroDefinition.C,v retrieving revision 1.19 diff -u -r1.19 MacroDefinition.C --- src/uipp/dxui/MacroDefinition.C 30 Sep 2003 17:41:47 -0000 1.19 +++ src/uipp/dxui/MacroDefinition.C 9 Dec 2003 10:29:01 -0000 @@ -107,7 +107,7 @@ this->body = NULL; } if (this->fileName) - delete this->fileName; + delete[] this->fileName; } void MacroDefinition::finishDefinition() @@ -216,7 +216,7 @@ { char *fileName = DuplicateString(n); if (this->fileName) - delete this->fileName; + delete[] this->fileName; this->fileName = fileName; } @@ -719,7 +719,7 @@ char *ignore = NULL; FILE *f = Network::OpenNetworkFILE(path, &wasEncoded, &ignore); - if (ignore) delete ignore; + if (ignore) delete[] ignore; if (f == NULL) { char *errtxt = "Failed to load macro file %s: %s"; @@ -753,7 +753,7 @@ exists=_findnext(handle,&entry); } _findclose(handle); - delete srch_string; + delete[] srch_string; #elif defined(HAVE_REGCOMP) && defined(HAVE_REGEX_H) } } Index: src/uipp/dxui/NodeDefinition.C =================================================================== RCS file: /src/master/dx/src/uipp/dxui/NodeDefinition.C,v retrieving revision 1.9 diff -u -r1.9 NodeDefinition.C --- src/uipp/dxui/NodeDefinition.C 30 Sep 2003 17:41:47 -0000 1.9 +++ src/uipp/dxui/NodeDefinition.C 9 Dec 2003 10:29:04 -0000 @@ -59,11 +59,11 @@ if (this->outboardHost) - delete this->outboardHost; + delete[] this->outboardHost; if (this->outboardCommand) - delete this->outboardCommand; + delete[] this->outboardCommand; if (this->loadFile) - delete this->loadFile; + delete[] this->loadFile; if (this->description) delete[] this->description; @@ -260,9 +260,9 @@ (inputs ? inputs : ""), (outputs ? outputs : "")); - delete header; - if (inputs) delete inputs; - if (outputs) delete outputs; + delete[] header; + if (inputs) delete[] inputs; + if (outputs) delete[] outputs; return mdf; } // @@ -360,7 +360,7 @@ } strcat(¶ms[currend], line); currend += linelen - 1; - delete line; + delete[] line; } if (inputs && this->isInputRepeatable()) { @@ -467,7 +467,7 @@ void NodeDefinition::setDefaultOutboardHost(const char *host) { if (this->outboardHost) - delete this->outboardHost; + delete[] this->outboardHost; this->outboardHost = DuplicateString(host); } boolean NodeDefinition::isOutboard() @@ -477,10 +477,10 @@ void NodeDefinition::setOutboardCommand(const char *command) { if (this->outboardCommand) - delete this->outboardCommand; + delete[] this->outboardCommand; if (this->loadFile) { - delete this->loadFile; + delete[] this->loadFile; this->loadFile = NULL; } @@ -497,14 +497,14 @@ void NodeDefinition::setDynamicLoadFile(const char *file) { if (this->loadFile) - delete this->loadFile; + delete[] this->loadFile; // // I tool can be either outboard or inboard (static) or inboard // (dynamic), but not both. // if (this->outboardCommand) { - delete this->outboardCommand; + delete[] this->outboardCommand; this->outboardCommand = NULL; } @@ -513,7 +513,7 @@ void NodeDefinition::setDescription(const char *d) { if (this->description) - delete this->description; + delete[] this->description; this->description = DuplicateString(d); } Index: src/uipp/dxui/ParameterDefinition.C =================================================================== RCS file: /src/master/dx/src/uipp/dxui/ParameterDefinition.C,v retrieving revision 1.10 diff -u -r1.10 ParameterDefinition.C --- src/uipp/dxui/ParameterDefinition.C 30 Sep 2003 17:41:47 -0000 1.10 +++ src/uipp/dxui/ParameterDefinition.C 9 Dec 2003 10:29:05 -0000 @@ -56,7 +56,7 @@ #if defined(DXD_WIN) || defined(OS2) delete (void *)this->typeStrings; #else - delete this->typeStrings; + delete[] this->typeStrings; #endif } if (DEFAULT_VALUE_NEEDS_DELETING(this)) @@ -65,7 +65,7 @@ if (this->valueOptions) { int i = 0; for (i=0; this->valueOptions[i] ; i++) - delete this->valueOptions[i]; + delete[] this->valueOptions[i]; FREE(this->valueOptions); } @@ -132,7 +132,7 @@ #if defined(DXD_WIN) || defined(OS2) delete (void*)this->typeStrings; #else - delete this->typeStrings; + delete[] this->typeStrings; #endif this->typeStrings = NULL; } @@ -177,7 +177,7 @@ #if defined(DXD_WIN) || defined(OS2) delete (void*)this->typeStrings; #else - delete this->typeStrings; + delete[] this->typeStrings; #endif this->typeStrings = NULL; } @@ -217,7 +217,7 @@ if (this->valueOptions) { int i = 0; for (i=0; this->valueOptions[i] ; i++) - delete this->valueOptions[i]; + delete[] this->valueOptions[i]; FREE(this->valueOptions); } this->valueOptions = 0; @@ -242,7 +242,7 @@ return FALSE; // Unrecognized value if (DEFAULT_VALUE_NEEDS_DELETING(this)) - delete this->default_value; + delete[] this->default_value; this->descriptive_default = FALSE; this->default_value = DuplicateString(value); @@ -330,7 +330,7 @@ void ParameterDefinition::setDescriptiveValue(const char *d) { if (DEFAULT_VALUE_NEEDS_DELETING(this)) - delete (char*)this->default_value; + delete[] (char*)this->default_value; this->default_value = DuplicateString(d); this->descriptive_default = TRUE; Index: src/uipp/dxuilib/MsgWin.C =================================================================== RCS file: /src/master/dx/src/uipp/dxuilib/MsgWin.C,v retrieving revision 1.13 diff -u -r1.13 MsgWin.C --- src/uipp/dxuilib/MsgWin.C 30 Sep 2003 17:41:48 -0000 1.13 +++ src/uipp/dxuilib/MsgWin.C 9 Dec 2003 10:29:12 -0000 @@ -584,7 +584,7 @@ XmStringFree(nameString); XmStringFree(firstHalf); XmStringFree(text); - delete line; + delete[] line; XmListAddItemUnselected(this->list, s, 0); XmStringFree(s); @@ -702,7 +702,7 @@ SelectableLine *l; while( (l = (SelectableLine*)li.getNext()) ) { - delete l->line; + delete[] l->line; delete l; } this->selectableLines.clear(); @@ -774,7 +774,7 @@ fputc('\n', this->logFile); } items[i] = XmStringCreate(s, "normal"); - delete s; + delete[] s; } XmListAddItems(this->list, items, nItems, 0); @@ -788,7 +788,7 @@ for (i = 0; i < nItems; ++i) XmStringFree(items[i]); - delete items; + delete[] items; this->batchedLines.clear(); @@ -814,7 +814,7 @@ char *s; ListIterator li(this->batchedLines); for (int i = 0; i < nItems && (s = (char*)li.getNext()); ++i) - delete s; + delete[] s; this->batchedLines.clear(); this->clearSelectableLines(); @@ -833,7 +833,7 @@ if (file == NULL && this->logFile) { fclose(this->logFile); - delete this->logFileName; + delete[] this->logFileName; this->logFile = NULL; this->logFileName = NULL; this->logOption->setState(FALSE); @@ -843,7 +843,7 @@ if (this->logFile) { fclose(this->logFile); - delete this->logFileName; + delete[] this->logFileName; } this->logFile = fopen(file, "w"); if (this->logFile == NULL) @@ -1078,7 +1078,7 @@ this->inst = inst; }; ~EdInfo () { - if (this->nodeName) delete this->nodeName; + if (this->nodeName) delete[] this->nodeName; }; }; // @@ -1132,7 +1132,7 @@ "Yes", "No", NULL, XmDIALOG_FULL_APPLICATION_MODAL ); - delete confMsg; + delete[] confMsg; questionPosted = TRUE; } }