From: eap Date: Fri, 6 Feb 2009 08:27:49 +0000 (+0000) Subject: Mismatched delete / delete [] X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=edde7db588c0cacd713e00b06fe52693007ed49e;p=modules%2Fkernel.git Mismatched delete / delete [] --- diff --git a/src/HDFPersist/HDFascii.cc b/src/HDFPersist/HDFascii.cc index 2884311b3..17642df5b 100644 --- a/src/HDFPersist/HDFascii.cc +++ b/src/HDFPersist/HDFascii.cc @@ -284,7 +284,7 @@ void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident) j = 0; } } - delete val; + delete [] val; } else if(type == HDF_INT32) { hdf_int32* val = new hdf_int32[size]; hdf_dataset->ReadFromDisk(val); @@ -542,21 +542,21 @@ bool CreateDatasetFromASCII(HDFcontainerObject *father, FILE *fp) read_float64(fp, &(val[i])); } hdf_dataset->WriteOnDisk(val); - delete val; + delete [] val; } else if(type == HDF_INT64) { hdf_int64* val = new hdf_int64[size]; for(i=0; iWriteOnDisk(val); - delete val; + delete [] val; } else if(type == HDF_INT32) { hdf_int32* val = new hdf_int32[size]; for(i=0; iWriteOnDisk(val); - delete val; + delete [] val; } char token[MAX_ID_SIZE]; @@ -605,7 +605,7 @@ bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp) hdf_attribute->CreateOnDisk(); - delete new_name; + delete [] new_name; if (type == HDF_STRING) { char tmp; @@ -614,7 +614,7 @@ bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp) val[size] = (char)0; fread(val, 1, size, fp); hdf_attribute->WriteOnDisk(val); - delete val; + delete [] val; } else if (type == HDF_FLOAT64) { hdf_float64 val; read_float64(fp, &val); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index ddd188d22..ee5457b34 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -125,9 +125,9 @@ SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const string& aUrl) char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.c_str()); aC_HDFUrl = new char[strlen(aResultPath) + 19]; sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath); - delete(aResultPath); + delete [] (aResultPath); aHDFUrl = aC_HDFUrl; - delete aC_HDFUrl; + delete [] aC_HDFUrl; } else { aHDFUrl = aUrl; } @@ -1319,7 +1319,7 @@ void ReadNoteBookVariables(SALOMEDSImpl_Study* theStudy, HDFgroup* theGroup) new_dataset->CloseOnDisk(); new_dataset = 0; //will be deleted by hdf_sco_group destructor order = atoi(currentVarIndex); - delete currentVarIndex; + delete [] currentVarIndex; } else order = iVar; @@ -1337,14 +1337,14 @@ void ReadNoteBookVariables(SALOMEDSImpl_Study* theStudy, HDFgroup* theGroup) SALOMEDSImpl_GenericVariable::VariableTypes aVarType = SALOMEDSImpl_GenericVariable::String2VariableType(string(currentVarType)); - delete currentVarType; + delete [] currentVarType; //Create variable and add it in the study SALOMEDSImpl_GenericVariable* aVariable = new SALOMEDSImpl_ScalarVariable(aVarType,string(aVarName)); aVariable->Load(string(currentVarValue)); aVarsMap.insert(make_pair(order,aVariable)); - delete currentVarValue; + delete [] currentVarValue; } }