Skip to content

Commit ec6be50

Browse files
committed
Address issue #90 where Comet will segfault if option -N is specified with a folder/subfolder that does not exist. Comet was attempting to free memory that was not allocated because the search was never initialized.
1 parent 51b013c commit ec6be50

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

CometSearch/CometPreprocess.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,9 @@ bool CometPreprocess::DeallocateMemory(int maxNumThreads)
19971997
{
19981998
int i;
19991999

2000+
if (!g_bCometPreprocessMemoryAllocated)
2001+
return true;
2002+
20002003
delete [] pbMemoryPool;
20012004

20022005
for (i=0; i<maxNumThreads; ++i)

CometSearch/CometSearch.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ bool CometSearch::AllocateMemory(int maxNumThreads)
8787

8888
bool CometSearch::DeallocateMemory(int maxNumThreads)
8989
{
90+
if (!g_bCometSearchMemoryAllocated)
91+
return true;
92+
9093
delete [] _pbSearchMemoryPool;
9194

9295
for (int i = 0; i < maxNumThreads; ++i)

CometSearch/CometSearchManager.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,10 +3066,6 @@ bool CometSearchManager::DoSearch()
30663066
fclose(fpdb);
30673067
}
30683068

3069-
// Clean up the input files vector
3070-
// g_staticParams.vectorMassOffsets.clear();
3071-
// g_staticParams.precursorNLIons.clear();
3072-
30733069
//MH: Deallocate spectral processing memory.
30743070
CometPreprocess::DeallocateMemory(g_staticParams.options.iNumThreads);
30753071

0 commit comments

Comments
 (0)