summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2018-12-26 08:49:26 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2018-12-26 10:49:42 (GMT)
commitb6662b61dd83be32481a1c83e092082e9d797f0a (patch)
treefcf4bf395d5bc6de2cbf94fc78dc25bd8772a521 /src
parent348a8cc72dd481fa9e65e6209946bfeef5716914 (diff)
downloadDoxygen-b6662b61dd83be32481a1c83e092082e9d797f0a.zip
Doxygen-b6662b61dd83be32481a1c83e092082e9d797f0a.tar.gz
Doxygen-b6662b61dd83be32481a1c83e092082e9d797f0a.tar.bz2
Fixed some more small memory leaks
Diffstat (limited to 'src')
-rw-r--r--src/doxygen.cpp5
-rw-r--r--src/entry.cpp2
-rw-r--r--src/marshal.cpp17
-rw-r--r--src/pycode.l6
4 files changed, 21 insertions, 9 deletions
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index e8df763..2d55ae6 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -9937,7 +9937,6 @@ void readFormulaRepository(QCString dir, bool cmp)
else
{
f=new Formula(formText);
- Doxygen::formulaList->setAutoDelete(TRUE);
Doxygen::formulaList->append(f);
Doxygen::formulaDict->insert(formText,f);
Doxygen::formulaNameDict->insert(formName,f);
@@ -10231,6 +10230,7 @@ void initDoxygen()
Doxygen::genericsDict = new GenericsSDict;
Doxygen::indexList = new IndexList;
Doxygen::formulaList = new FormulaList;
+ Doxygen::formulaList->setAutoDelete(TRUE);
Doxygen::formulaDict = new FormulaDict(1009);
Doxygen::formulaNameDict = new FormulaDict(1009);
Doxygen::sectionDict = new SectionDict(257);
@@ -10729,8 +10729,11 @@ void adjustConfiguration()
Doxygen::imageNameDict = new FileNameDict(257);
Doxygen::imageNameDict->setAutoDelete(TRUE);
Doxygen::dotFileNameDict = new FileNameDict(257);
+ Doxygen::dotFileNameDict->setAutoDelete(TRUE);
Doxygen::mscFileNameDict = new FileNameDict(257);
+ Doxygen::mscFileNameDict->setAutoDelete(TRUE);
Doxygen::diaFileNameDict = new FileNameDict(257);
+ Doxygen::diaFileNameDict->setAutoDelete(TRUE);
QCString outputLanguage=Config_getEnum(OUTPUT_LANGUAGE);
if (!setTranslator(outputLanguage))
diff --git a/src/entry.cpp b/src/entry.cpp
index 15c6fec..b3693cd 100644
--- a/src/entry.cpp
+++ b/src/entry.cpp
@@ -170,7 +170,7 @@ Entry::Entry(const Entry &e)
SectionInfo *s;
for (;(s=sli2.current());++sli2)
{
- anchors->append(new SectionInfo(*s));
+ anchors->append(s); // shallow copy, object are owned by Doxygen::sectionDict
}
// deep copy type constraint list
diff --git a/src/marshal.cpp b/src/marshal.cpp
index 57ff44b..1c7d54e 100644
--- a/src/marshal.cpp
+++ b/src/marshal.cpp
@@ -10,6 +10,7 @@
#include "groupdef.h"
#include "example.h"
#include "arguments.h"
+#include "doxygen.h"
#define HEADER ('D'<<24)+('O'<<16)+('X'<<8)+'!'
@@ -141,7 +142,9 @@ void marshalSectionInfoList(StorageIntf *s, QList<SectionInfo> *anchors)
marshalQCString(s,si->fileName);
marshalInt(s,si->lineNr);
marshalInt(s,si->level);
+ delete Doxygen::sectionDict->take(si->label); // this dict owns the anchor objects
}
+ anchors->clear();
}
}
@@ -550,11 +553,10 @@ QList<SectionInfo> *unmarshalSectionInfoList(StorageIntf *s)
uint i;
uint count = unmarshalUInt(s);
if (count==NULL_LIST) return 0; // null list
- QList<SectionInfo> *result = new QList<SectionInfo>;
- result->setAutoDelete(TRUE);
+ QList<SectionInfo> *anchors = new QList<SectionInfo>;
assert(count<1000000);
for (i=0;i<count;i++)
- {
+ {
QCString label = unmarshalQCString(s);
QCString title = unmarshalQCString(s);
QCString ref = unmarshalQCString(s);
@@ -562,9 +564,14 @@ QList<SectionInfo> *unmarshalSectionInfoList(StorageIntf *s)
QCString fileName = unmarshalQCString(s);
int lineNr = unmarshalInt(s);
int level = unmarshalInt(s);
- result->append(new SectionInfo(fileName,lineNr,label,title,type,level,ref));
+ if (Doxygen::sectionDict->find(label)==0)
+ {
+ SectionInfo *si = new SectionInfo(fileName,lineNr,label,title,type,level,ref);
+ anchors->append(si);
+ Doxygen::sectionDict->append(label,si); // this dict owns the anchor objects
+ }
}
- return result;
+ return anchors;
}
QList<ListItemInfo> *unmarshalItemInfoList(StorageIntf *s)
diff --git a/src/pycode.l b/src/pycode.l
index dfa383f..d9c9f01 100644
--- a/src/pycode.l
+++ b/src/pycode.l
@@ -1091,8 +1091,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT
char *s=g_curClassBases.first();
while (s)
{
- ClassDef *baseDefToAdd;
- baseDefToAdd=g_codeClassSDict[s];
+ ClassDef *baseDefToAdd=g_codeClassSDict[s];
// Try to find class in global
// scope
@@ -1517,6 +1516,8 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT
void resetPythonCodeParserState()
{
+ g_codeClassSDict.setAutoDelete(TRUE);
+ g_codeClassSDict.clear();
g_currentDefinition = 0;
g_currentMemberDef = 0;
g_doubleStringIsDoc = FALSE;
@@ -1567,6 +1568,7 @@ void parsePythonCode(CodeOutputInterface &od,const char * /*className*/,
//--------------------------------------
if (s.isEmpty()) return;
printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL);
+ g_codeClassSDict.setAutoDelete(TRUE);
TooltipManager::instance()->clearTooltips();
g_code = &od;
g_inputString = s;