diff --git a/src/classes/Makefile.PMusr b/src/classes/Makefile.PMusr index b1e576a0..95f30102 100644 --- a/src/classes/Makefile.PMusr +++ b/src/classes/Makefile.PMusr @@ -42,7 +42,7 @@ endif # -- Linux ifeq ($(OS),LINUX) CXX = g++ -CXXFLAGS = -O3 -Wall -Wno-trigraphs -fPIC +CXXFLAGS = -g -O3 -Wall -Wno-trigraphs -fPIC PMUSRPATH = ../include MNPATH = $(ROOTSYS)/include GSLPATH = /usr/include/gsl diff --git a/src/classes/PFitter.cpp b/src/classes/PFitter.cpp index 82da43e4..89314ff5 100644 --- a/src/classes/PFitter.cpp +++ b/src/classes/PFitter.cpp @@ -103,6 +103,16 @@ PFitter::~PFitter() { fCmdList.clear(); + if (fMnUserParamState) { + delete fMnUserParamState; + fMnUserParamState = 0; + } + + if (fFcnMin) { + delete fFcnMin; + fFcnMin = 0; + } + if (fFitterFcn) { delete fFitterFcn; fFitterFcn = 0; @@ -831,13 +841,17 @@ bool PFitter::ExecuteSave() hcorr->Draw("COLZTEXT"); else hcorr->Draw("COLZ"); - ccorr->Write(); + ccorr->Write("ccorr", TObject::kOverwrite, sizeof(ccorr)); ff.Close(); // clean up - if (ccorr) + if (ccorr) { delete ccorr; - if (hcorr) + ccorr = 0; + } + if (hcorr) { delete hcorr; + hcorr = 0; + } } parNo.clear(); // clean up } else { diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index a4623052..0a3de1d9 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -96,6 +96,11 @@ PMsrHandler::~PMsrHandler() fPlots.clear(); fStatistic.fStatLines.clear(); fParamInUse.clear(); + + if (fFuncHandler) { + delete fFuncHandler; + fFuncHandler = 0; + } } //-------------------------------------------------------------------------- diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index 09c1b8b5..070b31fa 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -1660,8 +1660,11 @@ bool PRunDataHandler::IsWhitespace(const char *str) { unsigned int i=0; - while (isblank(str[i]) || (iscntrl(str[i])) && str[i] != 0) + while (isblank(str[i]) || iscntrl(str[i])) { + if (str[i] == 0) + break; i++; + } if (i == strlen(str)) return true; diff --git a/src/classes/PTheory.cpp b/src/classes/PTheory.cpp index 10914162..0ee91e4f 100644 --- a/src/classes/PTheory.cpp +++ b/src/classes/PTheory.cpp @@ -301,15 +301,8 @@ PTheory::~PTheory() fLFIntegral.clear(); fDynLFFuncValue.clear(); - if (fMul) { - delete fMul; - fMul = 0; - } - - if (fAdd) { - delete fAdd; - fAdd = 0; - } + // recursive clean up + CleanUp(this); if (fUserFcn) { delete fUserFcn; @@ -664,6 +657,30 @@ double PTheory::Func(register double t, const PDoubleVector& paramValues, const return 0.0; } +//-------------------------------------------------------------------------- +/** + *
Recursively clean up theory + * + * \param theo + */ +void PTheory::CleanUp(PTheory *theo) +{ + if (theo->fMul) { // '*' present + CleanUp(theo->fMul); + if (theo->fAdd) { + CleanUp(theo->fAdd); + delete theo; + theo = 0; + } + } else { // '*' NOT present + if (theo->fAdd) { + CleanUp(theo->fAdd); + delete theo; + theo = 0; + } + } +} + //-------------------------------------------------------------------------- /** *
diff --git a/src/include/PTheory.h b/src/include/PTheory.h
index a077091f..330b78ac 100644
--- a/src/include/PTheory.h
+++ b/src/include/PTheory.h
@@ -199,6 +199,7 @@ class PTheory
virtual double Func(register double t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
private:
+ virtual void CleanUp(PTheory *theo);
virtual int SearchDataBase(TString name);
virtual void MakeCleanAndTidyTheoryBlock(PMsrLines* fullTheoryBlock);
virtual void MakeCleanAndTidyPolynom(unsigned int i, PMsrLines* fullTheoryBlock);
diff --git a/src/msr2msr.cpp b/src/msr2msr.cpp
index e90d1505..b9e8fb05 100644
--- a/src/msr2msr.cpp
+++ b/src/msr2msr.cpp
@@ -351,7 +351,7 @@ int main(int argc, char *argv[])
// read input file and write output file
char str[256];
- int tag;
+ int tag = -1;
bool success = true;
while (!fin.eof() && success) {
fin.getline(str, sizeof(str));
diff --git a/src/musrgui/musrgui_startup.xml b/src/musrgui/musrgui_startup.xml
index a0179129..afc46f38 100644
--- a/src/musrgui/musrgui_startup.xml
+++ b/src/musrgui/musrgui_startup.xml
@@ -123,10 +123,10 @@