From: <sla...@us...> - 2012-09-24 16:56:51
|
Revision: 5943 http://sashimi.svn.sourceforge.net/sashimi/?rev=5943&view=rev Author: slagelwa Date: 2012-09-24 16:56:45 +0000 (Mon, 24 Sep 2012) Log Message: ----------- Fix a few free pointer vs array reported by valgrind that have the potential of memory leaks/heap corruption on some platforms. Modified Paths: -------------- branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/mmotif.h branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/mscore.cpp branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/msequtilities.cpp Modified: branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/mmotif.h =================================================================== --- branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/mmotif.h 2012-09-18 09:56:48 UTC (rev 5942) +++ branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/mmotif.h 2012-09-24 16:56:45 UTC (rev 5943) @@ -366,7 +366,7 @@ } a++; } - delete pOut; + delete []pOut; return true; } Modified: branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/mscore.cpp =================================================================== --- branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/mscore.cpp 2012-09-18 09:56:48 UTC (rev 5942) +++ branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/mscore.cpp 2012-09-24 16:56:45 UTC (rev 5943) @@ -1,6 +1,6 @@ /* Copyright (C) 2003-2004 Ronald C Beavis, all rights reserved - X! tandem + X! tandem This software is a component of the X! proteomics software development project @@ -10,122 +10,122 @@ Preamble The intent of this document is to state the conditions under which a -Package may be copied, such that the Copyright Holder maintains some -semblance of artistic control over the development of the package, -while giving the users of the package the right to use and distribute -the Package in a more-or-less customary fashion, plus the right to -make reasonable modifications. +Package may be copied, such that the Copyright Holder maintains some +semblance of artistic control over the development of the package, +while giving the users of the package the right to use and distribute +the Package in a more-or-less customary fashion, plus the right to +make reasonable modifications. Definitions -"Package" refers to the collection of files distributed by the Copyright - Holder, and derivatives of that collection of files created through - textual modification. +"Package" refers to the collection of files distributed by the Copyright + Holder, and derivatives of that collection of files created through + textual modification. -"Standard Version" refers to such a Package if it has not been modified, - or has been modified in accordance with the wishes of the Copyright - Holder as specified below. +"Standard Version" refers to such a Package if it has not been modified, + or has been modified in accordance with the wishes of the Copyright + Holder as specified below. -"Copyright Holder" is whoever is named in the copyright or copyrights - for the package. +"Copyright Holder" is whoever is named in the copyright or copyrights + for the package. -"You" is you, if you're thinking about copying or distributing this Package. +"You" is you, if you're thinking about copying or distributing this Package. -"Reasonable copying fee" is whatever you can justify on the basis of - media cost, duplication charges, time of people involved, and so on. - (You will not be required to justify it to the Copyright Holder, but - only to the computing community at large as a market that must bear - the fee.) +"Reasonable copying fee" is whatever you can justify on the basis of + media cost, duplication charges, time of people involved, and so on. + (You will not be required to justify it to the Copyright Holder, but + only to the computing community at large as a market that must bear + the fee.) -"Freely Available" means that no fee is charged for the item itself, - though there may be fees involved in handling the item. It also means +"Freely Available" means that no fee is charged for the item itself, + though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same - conditions they received it. + conditions they received it. -1. You may make and give away verbatim copies of the source form of the -Standard Version of this Package without restriction, provided that -you duplicate all of the original copyright notices and associated -disclaimers. +1. You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that +you duplicate all of the original copyright notices and associated +disclaimers. -2. You may apply bug fixes, portability fixes and other modifications -derived from the Public Domain or from the Copyright Holder. A -Package modified in such a way shall still be considered the Standard -Version. +2. You may apply bug fixes, portability fixes and other modifications +derived from the Public Domain or from the Copyright Holder. A +Package modified in such a way shall still be considered the Standard +Version. -3. You may otherwise modify your copy of this Package in any way, provided -that you insert a prominent notice in each changed file stating how and -when you changed that file, and provided that you do at least ONE of the -following: +3. You may otherwise modify your copy of this Package in any way, provided +that you insert a prominent notice in each changed file stating how and +when you changed that file, and provided that you do at least ONE of the +following: -a. place your modifications in the Public Domain or otherwise make them - Freely Available, such as by posting said modifications to Usenet - or an equivalent medium, or placing the modifications on a major - archive site such as uunet.uu.net, or by allowing the Copyright Holder - to include your modifications in the Standard Version of the Package. -b. use the modified Package only within your corporation or organization. -c. rename any non-standard executables so the names do not conflict - with standard executables, which must also be provided, and provide - a separate manual page for each non-standard executable that clearly - documents how it differs from the Standard Version. -d. make other distribution arrangements with the Copyright Holder. +a. place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet + or an equivalent medium, or placing the modifications on a major + archive site such as uunet.uu.net, or by allowing the Copyright Holder + to include your modifications in the Standard Version of the Package. +b. use the modified Package only within your corporation or organization. +c. rename any non-standard executables so the names do not conflict + with standard executables, which must also be provided, and provide + a separate manual page for each non-standard executable that clearly + documents how it differs from the Standard Version. +d. make other distribution arrangements with the Copyright Holder. -4. You may distribute the programs of this Package in object code or -executable form, provided that you do at least ONE of the following: +4. You may distribute the programs of this Package in object code or +executable form, provided that you do at least ONE of the following: -a. distribute a Standard Version of the executables and library files, - together with instructions (in the manual page or equivalent) on - where to get the Standard Version. -b. accompany the distribution with the machine-readable source of the - Package with your modifications. -c. give non-standard executables non-standard names, and clearly - document the differences in manual pages (or equivalent), together - with instructions on where to get the Standard Version. -d. make other distribution arrangements with the Copyright Holder. +a. distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on + where to get the Standard Version. +b. accompany the distribution with the machine-readable source of the + Package with your modifications. +c. give non-standard executables non-standard names, and clearly + document the differences in manual pages (or equivalent), together + with instructions on where to get the Standard Version. +d. make other distribution arrangements with the Copyright Holder. -5. You may charge a reasonable copying fee for any distribution of -this Package. You may charge any fee you choose for support of -this Package. You may not charge a fee for this Package itself. -However, you may distribute this Package in aggregate with other -(possibly commercial) programs as part of a larger (possibly +5. You may charge a reasonable copying fee for any distribution of +this Package. You may charge any fee you choose for support of +this Package. You may not charge a fee for this Package itself. +However, you may distribute this Package in aggregate with other +(possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not a -dvertise this Package as a product of your own. You may embed this -Package's interpreter within an executable of yours (by linking); -this shall be construed as a mere form of aggregation, provided that -the complete Standard Version of the interpreter is so embedded. +dvertise this Package as a product of your own. You may embed this +Package's interpreter within an executable of yours (by linking); +this shall be construed as a mere form of aggregation, provided that +the complete Standard Version of the interpreter is so embedded. -6. The scripts and library files supplied as input to or produced as -output from the programs of this Package do not automatically fall -under the copyright of this Package, but belong to whomever generated -them, and may be sold commercially, and may be aggregated with this -Package. If such scripts or library files are aggregated with this -Package via the so-called "undump" or "unexec" methods of producing -a binary executable image, then distribution of such an image shall -neither be construed as a distribution of this Package nor shall it -fall under the restrictions of Paragraphs 3 and 4, provided that you -do not represent such an executable image as a Standard Version of -this Package. +6. The scripts and library files supplied as input to or produced as +output from the programs of this Package do not automatically fall +under the copyright of this Package, but belong to whomever generated +them, and may be sold commercially, and may be aggregated with this +Package. If such scripts or library files are aggregated with this +Package via the so-called "undump" or "unexec" methods of producing +a binary executable image, then distribution of such an image shall +neither be construed as a distribution of this Package nor shall it +fall under the restrictions of Paragraphs 3 and 4, provided that you +do not represent such an executable image as a Standard Version of +this Package. -7. C subroutines (or comparably compiled subroutines in other languages) -supplied by you and linked into this Package in order to emulate -subroutines and variables of the language defined by this Package -shall not be considered part of this Package, but are the equivalent -of input as in Paragraph 6, provided these subroutines do not change -the language in any way that would cause it to fail the regression -tests for the language. +7. C subroutines (or comparably compiled subroutines in other languages) +supplied by you and linked into this Package in order to emulate +subroutines and variables of the language defined by this Package +shall not be considered part of this Package, but are the equivalent +of input as in Paragraph 6, provided these subroutines do not change +the language in any way that would cause it to fail the regression +tests for the language. -8. Aggregation of this Package with a commercial distribution is always -permitted provided that the use of this Package is embedded; that is, -when no overt attempt is made to make this Package's interfaces visible -to the end user of the commercial distribution. Such use shall not be -construed as a distribution of this Package. +8. Aggregation of this Package with a commercial distribution is always +permitted provided that the use of this Package is embedded; that is, +when no overt attempt is made to make this Package's interfaces visible +to the end user of the commercial distribution. Such use shall not be +construed as a distribution of this Package. -9. The name of the Copyright Holder may not be used to endorse or promote -products derived from this software without specific prior written permission. +9. The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. -10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. -The End +The End */ // File version: 2003-08-01 @@ -159,7 +159,7 @@ */ bool lessThanDetails(const mspectrumdetails &_l,const mspectrumdetails &_r) { - return _l.m_fL < _r.m_fL; + return _l.m_fL < _r.m_fL; } /* * global less than operator for mi classes: to be used in sort operations to achieve @@ -185,7 +185,7 @@ m_fParentErrPlus = 2.0; m_fParentErrMinus = 2.0; m_fErr = (float)0.45; - + m_fWidth = 1.0; m_lMaxCharge = 100; m_dSeqMH = -1.0; @@ -216,13 +216,13 @@ mscore::~mscore(void) { if(m_pfSeq != NULL) - delete m_pfSeq; + delete[] m_pfSeq; if(m_plSeq != NULL) - delete m_plSeq; + delete[] m_plSeq; if(m_pSeq != NULL) delete[] m_pSeq; if(m_plAA != NULL) - delete m_plAA; + delete[] m_plAA; } bool mscore::set_mini(const bool _b) @@ -290,7 +290,7 @@ * deal with protein N-terminus */ if(m_bIsN) { - dValue += m_pSeqUtilFrag->m_fNT; + dValue += m_pSeqUtilFrag->m_fNT; } /* * deal with non-hydrolytic cleavage @@ -335,7 +335,7 @@ a++; } /* - * set the next integer mass value to 0: this marks the end of the array + * set the next integer mass value to 0: this marks the end of the array */ m_lCount = lCount; m_plSeq[lCount] = 0; @@ -356,7 +356,7 @@ * deal with protein N-terminus */ if(m_bIsN) { - dValue += m_pSeqUtilFrag->m_fNT; + dValue += m_pSeqUtilFrag->m_fNT; } /* * deal with non-hydrolytic cleavage @@ -428,7 +428,7 @@ * deal with protein N-terminus */ if(m_bIsN) { - dValue += m_pSeqUtilFrag->m_fNT; + dValue += m_pSeqUtilFrag->m_fNT; } /* * deal with non-hydrolytic cleavage @@ -500,7 +500,7 @@ * deal with protein C-teminus */ if(m_bIsC) { - dValue += m_pSeqUtilFrag->m_fCT; + dValue += m_pSeqUtilFrag->m_fCT; } unsigned long lValue = 0; /* @@ -538,7 +538,7 @@ a--; } /* - * set the next integer mass value to 0: this marks the end of the array + * set the next integer mass value to 0: this marks the end of the array */ m_lCount = lCount; m_plSeq[lCount] = 0; @@ -569,7 +569,7 @@ * deal with protein C-teminus */ if(m_bIsC) { - dValue += m_pSeqUtilFrag->m_fCT; + dValue += m_pSeqUtilFrag->m_fCT; } unsigned long lCount = 0; float fSub = 0.0; @@ -624,7 +624,7 @@ a--; } /* - * set the next integer mass value to 0: this marks the end of the array + * set the next integer mass value to 0: this marks the end of the array */ m_lCount = lCount; m_plSeq[lCount] = 0; @@ -656,7 +656,7 @@ * deal with protein C-teminus */ if(m_bIsC) { - dValue += m_pSeqUtilFrag->m_fCT; + dValue += m_pSeqUtilFrag->m_fCT; } size_t tC = 0; unsigned long lCount = 0; @@ -693,7 +693,7 @@ a--; } /* - * set the next integer mass value to 0: this marks the end of the array + * set the next integer mass value to 0: this marks the end of the array */ m_lCount = lCount; m_plSeq[lCount] = 0; @@ -750,7 +750,7 @@ } /* - * add_mi does the work necessary to set up an mspectrum object for modeling. + * add_mi does the work necessary to set up an mspectrum object for modeling. * - a copy of the mspectrum object is added to m_vSpec * - an entry in the m_State object is made for the parent ion M+H * once an mspectrum has been added, the original mspectrum is no longer @@ -832,7 +832,7 @@ return set_seq(_s,_n,_c,_l,_f); } /* - * copy the new part of the sequence into m_pSeq + * copy the new part of the sequence into m_pSeq */ strcpy(m_pSeq + lOldLength,_s + lOldLength); unsigned long a = lOldLength; @@ -878,7 +878,7 @@ if(m_bIsC) m_dSeqMH += m_seqUtil.m_fCT; /* - * update the mstate object + * update the mstate object */ m_State.m_dSeqMHS = m_dSeqMH; m_fMinMass = (float)m_dSeqMH; @@ -955,7 +955,7 @@ return false; } /* - * get_aa is used to check the current sequence and determine how many of + * get_aa is used to check the current sequence and determine how many of * the residues correspond to modification sites. this method is not used * by mscore: check mprocess to see an example of how it is used to create * a list of modified residues in a domain @@ -1012,7 +1012,7 @@ } } a++; - } + } if(m_seqUtil.m_bSequenceMods) { SMap::iterator itValue = m_seqUtil.m_mapMods.begin(); SMap::const_iterator itEnd = m_seqUtil.m_mapMods.end(); @@ -1146,7 +1146,7 @@ /* * load_next is used access the potential sequence modification state machine. * it runs the state machine until either: - * - a modified sequence that has a mass that is within error of + * - a modified sequence that has a mass that is within error of * one of the mspectrum objects has been found, or * - the last of the modified sequences has been returned * it returns true if there are more sequences to consider. @@ -1417,7 +1417,7 @@ /* * load_state is used access the potential sequence modification state machine. * it runs the state machine until either: - * - a modified sequence that has a mass that is within error of + * - a modified sequence that has a mass that is within error of * one of the mspectrum objects has been found, or * - the last of the modified sequences has been returned * it returns true if there are more sequences to consider. @@ -1592,7 +1592,7 @@ { unsigned long pos = m_State.m_piMods[i]; *(m_State.m_ppModsS[pos]) += 32; - m_dSeqMH += m_seqUtil.m_pdAaMod[*(m_State.m_ppModsS[pos])]; + m_dSeqMH += m_seqUtil.m_pdAaMod[*(m_State.m_ppModsS[pos])]; } */ m_plAA['s'] = 0; m_plAA['t'] = 0; @@ -1853,9 +1853,9 @@ m_lSeqLength = _l; if(m_lSeqLength >= m_lSize-1) { if(m_pfSeq != NULL) - delete m_pfSeq; + delete[] m_pfSeq; if(m_plSeq != NULL) - delete m_plSeq; + delete[] m_plSeq; if(m_pSeq != NULL) delete[] m_pSeq; m_lSize = m_lSeqLength + 16; Modified: branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/msequtilities.cpp =================================================================== --- branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/msequtilities.cpp 2012-09-18 09:56:48 UTC (rev 5942) +++ branches/4-6/trans_proteomic_pipeline/extern/xtandem/src_tpp/msequtilities.cpp 2012-09-24 16:56:45 UTC (rev 5943) @@ -530,7 +530,7 @@ } pValue++; } - delete pString; + delete[] pString; return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |