Menu

#1 [cppcheck] found a lots of errors

open
nobody
None
5
2009-12-31
2009-12-31
orbitcowboy
No

during a check with the static code analysis tool cppcheck (http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page) the tool found a lots of missmatching of allocation and deallocation issues:

Here the output of the tool:

[PTssh.cpp:669]: (Error) Mismatching allocation and deallocation: pSigData
[PTssh.cpp:831]: (Error) Mismatching allocation and deallocation: pSigData
[../examples/SFTP_usingWrapperDLL/sftp.cpp:297]: (Error) Mismatching allocation and deallocation: pTmpBuf
[../examples/PTsshTesting/main.cpp:323]: (Error) Mismatching allocation and deallocation: pPretty
[../examples/PTsshTesting/main.cpp:478]: (Error) Mismatching allocation and deallocation: pBuf
[../examples/threadedSendAndReceive/threadedSCP.cpp:478]: (Error) Mismatching allocation and deallocation: pBuf
[../examples/Sftp_usingClass/sftp.cpp:258]: (Error) Mismatching allocation and deallocation: pBuf
[../examples/scpSend/scpSend.cpp:270]: (Error) Resource leak: pFileHandle
[../examples/scpSend/scpSend.cpp:227]: (Error) Mismatching allocation and deallocation: pBuf

a missmatch of allocation and deallocation happens e.g:

// ...
int *pBuf = new int[100];
// ...
delete pBuf; // < -wrong way
delete [] pBuf; // <--correct way

Doing this the wrong way leads to a memory leak.

Best regards

Ettl Martin

Discussion


Log in to post a comment.

MongoDB Logo MongoDB