Miranda NG Official Community Forum

Forum for English speaking Miranda NG users => Development => Topic started by: Goraf on 07 12 2014, 15:11:24

Title: Cppcheck - static code analysis results
Post by: Goraf on 07 12 2014, 15:11:24
Rev. 11828
Core
core - errors
[Miranda NG\src\core\memory.cpp:84]: (error) Memory leak: p
[Miranda NG\src\core\memory.cpp:110]: (error) Common realloc mistake: 'p' nulled but not freed upon failure
[Miranda NG\src\core\stdmsg\src\msglog.cpp:319]: (error) Uninitialized variable: szName
[Miranda NG\src\core\stdmsg\src\msgdialog.cpp:1664]: (error) Buffer is accessed out of bounds.
[close]
core - warnings (optional)
memory
[Miranda NG\src\core\memory.cpp:164] -> [Miranda NG\src\core\memory.cpp:163]: (warning) Possible null pointer dereference: p - otherwise it is redundant to check it against null.
[Miranda NG\src\core\memory.cpp:165] -> [Miranda NG\src\core\memory.cpp:163]: (warning) Possible null pointer dereference: p - otherwise it is redundant to check it against null.
[close]
stdchat
[Miranda NG\src\core\stdchat\src\chat.h:117]: (warning) Member variable 'CREOleCallback::pictStg' is not initialized in the constructor.
[Miranda NG\src\core\stdchat\src\chat.h:117]: (warning) Member variable 'CREOleCallback::nextStgId' is not initialized in the constructor.
[Miranda NG\src\core\stdchat\src\message.cpp:250]: (warning) %x in format string (no. 1) requires 'unsigned int *' but the argument type is 'char *'.
[close]
stdcrypt
[Miranda NG\src\core\stdcrypt\encrypt.cpp:35]: (warning) Member variable 'CStdCrypt::m_valid' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\encrypt.cpp:35]: (warning) Member variable 'CStdCrypt::m_key' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::m_Ke' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::m_Kd' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::m_keylength' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::m_blockSize' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::m_iROUNDS' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::m_chain0' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::m_chain' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::tk' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::a' is not initialized in the constructor.
[Miranda NG\src\core\stdcrypt\Rijndael.cpp:940]: (warning) Member variable 'CRijndael::t' is not initialized in the constructor.
[close]
stdmsg
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::hDbEventFirst' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::hDbEventLast' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::hBkgBrush' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::splitterPos' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::originalSplitterPos' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::lineHeight' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::windowWasCascaded' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::nFlash' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::nLabelRight' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::nTypeSecs' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::nTypeMode' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::avatarWidth' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::avatarHeight' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::limitAvatarH' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::avatarPic' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::nLastTyping' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::showTyping' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::lastMessage' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::hwndStatus' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::hTimeZone' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::szProto' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::wStatus' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::wOldStatus' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::cmdListInd' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::bIsAutoRTL' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::bIsMeta' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:38]: (warning) Member variable 'SrmmWindowData::wMinute' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:102]: (warning) Member variable 'CREOleCallback::pictStg' is not initialized in the constructor.
[Miranda NG\src\core\stdmsg\src\msgs.h:102]: (warning) Member variable 'CREOleCallback::nextStgId' is not initialized in the constructor.
[close]
[close]

Mir_core
mir_core - errors
[Miranda NG\src\mir_core\logger.cpp:166]: (error) va_list 'args' was opened but not closed by va_end().
[Miranda NG\src\mir_core\logger.cpp:187]: (error) va_list 'args' was opened but not closed by va_end().
[Miranda NG\src\mir_core\memory.cpp:84]: (error) Memory leak: p
[Miranda NG\src\mir_core\memory.cpp:110]: (error) Common realloc mistake: 'p' nulled but not freed upon failure
[Miranda NG\src\mir_core\protos.cpp:254]: (error) Resource leak: hFile
[Miranda NG\src\mir_core\json\JSONMemory.cpp:67]: (error) Memory is allocated but not initialized: result
[Miranda NG\src\mir_core\json\internalJSONNode.h:229]: (error) Null pointer dereference
[Miranda NG\src\mir_core\json\internalJSONNode.cpp:86]: (error) Null pointer dereference
[Miranda NG\src\mir_core\json\internalJSONNode.cpp:113]: (error) Null pointer dereference
[close]

Modules
modules - errors
[Miranda NG\src\modules\fonts\FontOptions.cpp:140]: (error) Resource leak: fhand
[Miranda NG\src\modules\icolib\extracticon.cpp:255]: (error) Resource leak: hFile
[Miranda NG\src\modules\netlib\netlibsecurity.cpp:206]: (error) Uninitialized variable: inDataBuffer
[Miranda NG\src\modules\plugins\dll_sniffer.cpp:43]: (error) Resource leak: hFile
[close]
modules - warnings
clist
[Miranda NG\src\modules\clist\genmenu.cpp:1191]: (warning) Member variable 'TIntMenuObject::pszName' is not initialized in the constructor.
[Miranda NG\src\modules\clist\genmenu.cpp:1191]: (warning) Member variable 'TIntMenuObject::ptszDisplayName' is not initialized in the constructor.
[Miranda NG\src\modules\clist\genmenu.cpp:1191]: (warning) Member variable 'TIntMenuObject::id' is not initialized in the constructor.
[Miranda NG\src\modules\clist\genmenu.cpp:1191]: (warning) Member variable 'TIntMenuObject::ExecService' is not initialized in the constructor.
[Miranda NG\src\modules\clist\genmenu.cpp:1191]: (warning) Member variable 'TIntMenuObject::CheckService' is not initialized in the constructor.
[Miranda NG\src\modules\clist\genmenu.cpp:1191]: (warning) Member variable 'TIntMenuObject::FreeService' is not initialized in the constructor.
[Miranda NG\src\modules\clist\genmenu.cpp:1191]: (warning) Member variable 'TIntMenuObject::onAddService' is not initialized in the constructor.
[Miranda NG\src\modules\clist\genmenu.cpp:1191]: (warning) Member variable 'TIntMenuObject::m_items' is not initialized in the constructor.
[Miranda NG\src\modules\clist\genmenu.cpp:1191]: (warning) Member variable 'TIntMenuObject::m_bUseUserDefinedItems' is not initialized in the constructor.
[close]
database
[Miranda NG\src\modules\database\mdatabasecache.cpp:37]: (warning) Member variable 'MDatabaseCache::m_lastSetting' is not initialized in the constructor.
[Miranda NG\src\modules\database\mdatabasecache.cpp:37]: (warning) Member variable 'MDatabaseCache::m_lastVL' is not initialized in the constructor.
[close]
fonts
[Miranda NG\src\modules\fonts\FontOptions.cpp:179]: (warning) Dangerous usage of strncat - 3rd parameter is the maximum number of characters to append.
[Miranda NG\src\modules\fonts\FontOptions.cpp:183]: (warning) Dangerous usage of strncat - 3rd parameter is the maximum number of characters to append.
[Miranda NG\src\modules\fonts\FontOptions.cpp:186]: (warning) Dangerous usage of strncat - 3rd parameter is the maximum number of characters to append.
[close]
netlib
[Miranda NG\src\modules\netlib\netlibopenconn.cpp:367] -> [Miranda NG\src\modules\netlib\netlibopenconn.cpp:390]: (warning) Possible null pointer dereference: nloc - otherwise it is redundant to check it against null.
[close]
options
[Miranda NG\src\modules\options\headerbar.cpp:50]: (warning) Member variable 'MHeaderbarCtrl::hwnd' is not initialized in the constructor.
[Miranda NG\src\modules\options\headerbar.cpp:50]: (warning) Member variable 'MHeaderbarCtrl::width' is not initialized in the constructor.
[Miranda NG\src\modules\options\headerbar.cpp:50]: (warning) Member variable 'MHeaderbarCtrl::height' is not initialized in the constructor.
[Miranda NG\src\modules\options\headerbar.cpp:50]: (warning) Member variable 'MHeaderbarCtrl::hIcon' is not initialized in the constructor.
[Miranda NG\src\modules\options\headerbar.cpp:50]: (warning) Member variable 'MHeaderbarCtrl::clText' is not initialized in the constructor.
[Miranda NG\src\modules\options\headerbar.cpp:50]: (warning) Member variable 'MHeaderbarCtrl::nControlsToRedraw' is not initialized in the constructor.
[Miranda NG\src\modules\options\headerbar.cpp:50]: (warning) Member variable 'MHeaderbarCtrl::controlsToRedraw' is not initialized in the constructor.
[Miranda NG\src\modules\options\headerbar.cpp:50]: (warning) Member variable 'MHeaderbarCtrl::hFont' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::hwnd' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::nSelectedIdx' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::nHotIdx' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::bMouseInside' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::width' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::height' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::itemWidth' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::itemHeight' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::hBkgBmp' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::hBkgOldBmp' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::hBkgDC' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::clText' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::clSelText' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::clSelBorder' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::clHotText' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::clHotBorder' is not initialized in the constructor.
[Miranda NG\src\modules\options\iconheader.cpp:52]: (warning) Member variable 'MIcoTabCtrl::hFont' is not initialized in the constructor.
[Miranda NG\src\modules\options\options.cpp:98]: (warning) Member variable 'OptionsDlgData::currentPage' is not initialized in the constructor.
[Miranda NG\src\modules\options\options.cpp:98]: (warning) Member variable 'OptionsDlgData::hBoldFont' is not initialized in the constructor.
[Miranda NG\src\modules\options\options.cpp:98]: (warning) Member variable 'OptionsDlgData::szFilterString' is not initialized in the constructor.
[Miranda NG\src\modules\options\options.cpp:98]: (warning) Member variable 'OptionsDlgData::hPluginLoad' is not initialized in the constructor.
[Miranda NG\src\modules\options\options.cpp:98]: (warning) Member variable 'OptionsDlgData::hPluginUnload' is not initialized in the constructor.
[close]
plugins
[Miranda NG\src\modules\plugins\dll_sniffer.cpp:108] -> [Miranda NG\src\modules\plugins\dll_sniffer.cpp:106]: (warning) Possible null pointer dereference: pExp - otherwise it is redundant to check it against null.
[close]
srmm
[Miranda NG\src\modules\srmm\statusicon.cpp:52]: (warning) Member variable 'StatusIconMain::hPangpack' is not initialized in the constructor.
[close]
[close]
Title: Re: Cppcheck - static code analysis results
Post by: Goraf on 07 12 2014, 15:36:12
Protocols

Skipped warnings:

AIM
AIM - warnings
[Miranda NG\protocols\AimOscar\src\server.cpp:761]: (warning) String literal compared with variable 'name'. Did you intend to use strcmp() instead?
[Miranda NG\protocols\AimOscar\src\server.cpp:902]: (warning) String literal compared with variable 'name'. Did you intend to use strcmp() instead?
[Miranda NG\protocols\AimOscar\src\server.cpp:972]: (warning) String literal compared with variable 'name'. Did you intend to use strcmp() instead?
[Miranda NG\protocols\AimOscar\src\server.cpp:978]: (warning) String literal compared with variable 'name'. Did you intend to use strcmp() instead?
[Miranda NG\protocols\AimOscar\src\utility.cpp:244] -> [Miranda NG\protocols\AimOscar\src\utility.cpp:265]: (warning) Possible null pointer dereference: new_group - otherwise it is redundant to check it against null.
[close]

EmLanProto
EmLan - errors
[Miranda NG\protocols\EmLanProto\src\mlan.h:43]: (error) Mismatching allocation and deallocation: TDataHolder::msg
[Miranda NG\protocols\EmLanProto\src\lan.cpp:266]: (error) Resource leak: out_socket
[Miranda NG\protocols\EmLanProto\src\lan.cpp:245]: (error) Return value of allocation function CreateThread is not used.
[Miranda NG\protocols\EmLanProto\src\lan.cpp:286]: (error) Return value of allocation function CreateThread is not used.
[Miranda NG\protocols\EmLanProto\src\mlan.cpp:496]: (error) Returning/dereferencing 'cid' after it is deallocated / released
[Miranda NG\protocols\EmLanProto\src\mlan.cpp:504]: (error) Returning/dereferencing 'cid' after it is deallocated / released
[close]

GTalkExt
GTalkExt - errors
[Miranda NG\protocols\GTalkExt\src\avatar.cpp:53]: (error) Resource leak: h
[close]

GG
GG - errors
[Miranda NG\protocols\Gadu-Gadu\src\core.cpp:728]: (error) Null pointer dereference
[Miranda NG\protocols\Gadu-Gadu\src\core.cpp:732]: (error) Null pointer dereference
[Miranda NG\protocols\Gadu-Gadu\src\dynstuff.cpp:488]: (error) Common realloc mistake: 'result' nulled but not freed upon failure
[Miranda NG\protocols\Gadu-Gadu\src\dynstuff.cpp:556]: (error) Memory leak: s
[Miranda NG\protocols\Gadu-Gadu\src\filetransfer.cpp:670]: (error) Dangerous usage of 'fileName' (strncpy doesn't always null-terminate it).
[Miranda NG\protocols\Gadu-Gadu\src\filetransfer.cpp:712]: (error) Dangerous usage of 'fileName' (strncpy doesn't always null-terminate it).
[Miranda NG\protocols\Gadu-Gadu\src\gg_proto.cpp:502]: (error) Null pointer dereference
[Miranda NG\protocols\Gadu-Gadu\src\gg_proto.cpp:510]: (error) Null pointer dereference
[Miranda NG\protocols\Gadu-Gadu\src\groupchat.cpp:261]: (error) Memory is allocated but not initialized: chat
[Miranda NG\protocols\Gadu-Gadu\src\libgadu\common.cpp:222]: (error) va_list 'aq' was opened but not closed by va_end().
[Miranda NG\protocols\Gadu-Gadu\src\libgadu\libgadu.cpp:1874]: (error) Memory leak: buf
[Miranda NG\protocols\Gadu-Gadu\src\libgadu\libgadu.cpp:572]: (error) Memory leak: buf
[Miranda NG\protocols\Gadu-Gadu\src\libgadu\win32.cpp:34]: (error) Resource leak: sock
[close]
GG - warnings
[Miranda NG\protocols\Gadu-Gadu\src\core.cpp:203] -> [Miranda NG\protocols\Gadu-Gadu\src\core.cpp:202]: (warning) Possible null pointer dereference: var - otherwise it is redundant to check it against null.
[Miranda NG\protocols\Gadu-Gadu\src\dialogs.cpp:732] -> [Miranda NG\protocols\Gadu-Gadu\src\dialogs.cpp:735]: (warning) Possible null pointer dereference: dat - otherwise it is redundant to check it against null.
[Miranda NG\protocols\Gadu-Gadu\src\libgadu\pubdir.cpp:744]: (warning) scanf without field width limits can crash with huge input data.
[close]

IRC
IRC - warnings
[Miranda NG\protocols\IRCG\src\irclib.cpp:1427]: (warning) %d in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'.
[Miranda NG\protocols\IRCG\src\irclib.cpp:1427]: (warning) %d in format string (no. 2) requires 'int *' but the argument type is 'unsigned int *'.
[Miranda NG\protocols\IRCG\src\irclib.cpp:78]: (warning) Member variable 'CIrcMessage::m_proto' is not assigned a value in 'CIrcMessage::operator='.
[Miranda NG\protocols\IRCG\src\irclib.cpp:78]: (warning) Member variable 'CIrcMessage::m_codePage' is not assigned a value in 'CIrcMessage::operator='.
[Miranda NG\protocols\IRCG\src\output.cpp:79]: (warning) Logical disjunction always evaluates to true: index > 400 || index < 500.
[Miranda NG\protocols\IRCG\src\output.cpp:142]: (warning) Logical disjunction always evaluates to true: iTemp > 400 || iTemp < 500.
[close]

ICQ
ICQ - warnings
[Miranda NG\protocols\IcqOscarJ\src\icq_packet.cpp:647] -> [Miranda NG\protocols\IcqOscarJ\src\icq_packet.cpp:629]: (warning) Possible null pointer dereference: wLength - otherwise it is redundant to check it against null.
[close]

Jabber
Jabber - errors
[Miranda NG\protocols\JabberG\src\jabber_iqid.cpp:602]: (error) Resource leak: hFile
[close]
Jabber - warnings
[Miranda NG\protocols\JabberG\src\ui_utils.h:205] -> [Miranda NG\protocols\JabberG\src\ui_utils.h:184]: (warning) The class 'CDbLink' defines member variable with name 'm_bSigned' also defined in its parent class 'CDataLink'.
[Miranda NG\protocols\JabberG\src\jabber_db_utils.h:99]: (warning) Member variable 'CMOptionBase::m_proto' is not assigned a value in 'CMOptionBase::operator='.
[Miranda NG\protocols\JabberG\src\jabber_db_utils.h:99]: (warning) Member variable 'CMOptionBase::m_szSetting' is not assigned a value in 'CMOptionBase::operator='.
[Miranda NG\protocols\JabberG\src\jabber_db_utils.h:125]: (warning) Member variable 'CMOption<unsignedchar>::m_default' is not assigned a value in 'CMOption<unsignedchar>::operator='.
[Miranda NG\protocols\JabberG\src\jabber_db_utils.h:125]: (warning) Member variable 'CMOption<unsignedlong>::m_default' is not assigned a value in 'CMOption<unsignedlong>::operator='.
[Miranda NG\protocols\JabberG\src\jabber_form.cpp:757] -> [Miranda NG\protocols\JabberG\src\jabber_form.cpp:729]: (warning) Possible null pointer dereference: jfi - otherwise it is redundant to check it against null.
[Miranda NG\protocols\JabberG\src\jabber_thread.cpp:1989]: (warning) Logical conjunction always evaluates to false: c > 9 && c < 10.
[close]

MRA
MRA - errors
[Miranda NG\protocols\MRA\src\Sdk\InternetTime.h:204]: (error) Array 'lpcszenmMonthEnum[13]' accessed at index 13, which is out of bounds.
[Miranda NG\protocols\MRA\src\Sdk\InternetTime.h:181]: (error) Array 'lpcszenmDayOfWeakEnum[7]' accessed at index 7, which is out of bounds.
[Miranda NG\protocols\MRA\src\MraSendCommand.cpp:18]: (error) Common realloc mistake: 'm_buf' nulled but not freed upon failure
[close]
MRA - warnings
[Miranda NG\protocols\MRA\src\Sdk\ListMT.h:180] -> [Miranda NG\protocols\MRA\src\Sdk\ListMT.h:171]: (warning) Possible null pointer dereference: plmtiNextNode - otherwise it is redundant to check it against null.
[Miranda NG\protocols\MRA\src\Mra_proto.cpp:1244]: (warning) Redundant assignment of 'dwTemp' to itself.
[close]

MSN
MSN - errors
[Miranda NG\protocols\MSN\src\ezxml.c:204]: (error) Allocation with malloc, strcpy doesn't release it.
[Miranda NG\protocols\MSN\src\ezxml.c:255]: (error) Allocation with malloc, strcpy doesn't release it.
[Miranda NG\protocols\MSN\src\ezxml.c:349]: (error) Common realloc mistake: 'ent' nulled but not freed upon failure
[Miranda NG\protocols\MSN\src\ezxml.c:448]: (error) Common realloc mistake: 'u' nulled but not freed upon failure
[Miranda NG\protocols\MSN\src\ezxml.c:621]: (error) Common realloc mistake: 's' nulled but not freed upon failure
[Miranda NG\protocols\MSN\src\ezxml.c:734]: (error) Common realloc mistake: 's' nulled but not freed upon failure
[Miranda NG\protocols\MSN\src\ezxml.c:749]: (error) Common realloc mistake: 's' nulled but not freed upon failure
[Miranda NG\protocols\MSN\src\ezxml.c:457]: (error) Memory leak: u
[Miranda NG\protocols\MSN\src\ezxml.c:740]: (error) Memory leak: s
[Miranda NG\protocols\MSN\src\msn_threads.cpp:398]: (error) Dead pointer usage. Pointer 'result' is dead if it has been assigned '&T' at line 394.
[close]
MSN - warnings
[Miranda NG\protocols\MSN\src\ezxml.c:92] -> [Miranda NG\protocols\MSN\src\ezxml.c:88]: (warning) Possible null pointer dereference: root - otherwise it is redundant to check it against null.
[Miranda NG\protocols\MSN\src\ezxml.c:727] -> [Miranda NG\protocols\MSN\src\ezxml.c:726]: (warning) Possible null pointer dereference: root - otherwise it is redundant to check it against null.
[Miranda NG\protocols\MSN\src\msn_commands.cpp:693] -> [Miranda NG\protocols\MSN\src\msn_commands.cpp:692]: (warning) Possible null pointer dereference: msc - otherwise it is redundant to check it against null.
[Miranda NG\protocols\MSN\src\msn_commands.cpp:695] -> [Miranda NG\protocols\MSN\src\msn_commands.cpp:692]: (warning) Possible null pointer dereference: msc - otherwise it is redundant to check it against null.
[Miranda NG\protocols\MSN\src\msn_ftold.cpp:101]: (warning) scanf without field width limits can crash with huge input data.
[Miranda NG\protocols\MSN\src\msn_p2p.cpp:1643]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\MSN\src\msn_threads.cpp:611]: (warning) scanf without field width limits can crash with huge input data.
[Miranda NG\protocols\MSN\src\msn_threads.cpp:619]: (warning) scanf without field width limits can crash with huge input data.
[close]

Sametime
Sametime - errors
[Miranda NG\protocols\Sametime\src\glib\gasyncqueue.c:433]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gbase64.c:216]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gbitlock.c:134]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gbookmarkfile.c:267]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gcompletion.c:152]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gthread.h:347]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gdataset.c:1155]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gdatetime.c:1464]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\giochannel.c:1117]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gkeyfile.c:246]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gmain.c:2100]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:681]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2335]: (error) va_list 'args2' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2336]: (error) va_list 'args2' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2642]: (error) va_list 'ap' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2653]: (error) va_list 'ap' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2666]: (error) va_list 'ap' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2682]: (error) va_list 'ap' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2690]: (error) va_list 'ap' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2701]: (error) va_list 'ap' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2702]: (error) va_list 'ap' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gmarkup.c:2705]: (error) va_list 'ap' used before va_start() was called.
[Miranda NG\protocols\Sametime\src\glib\gqueue.c:432]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\grand.c:232]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\grel.c:343]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\grel.c:273]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gscanner.c:1689]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gsequence.c:1644]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gshell.c:103]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gtimezone.c:149]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gtree.c:531]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gvariant-core.c:619]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gvariant-parser.c:88]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gvariant-parser.c:1958]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gvariant-serialiser.c:867]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\gvariant.c:350]: (error) syntax error
[Miranda NG\protocols\Sametime\src\glib\win_iconv.c:1540]: (error) Uninitialized variable: wc
[Miranda NG\protocols\Sametime\src\glib\win_iconv.c:1964]: (error) Resource leak: in
[Miranda NG\protocols\Sametime\src\meanwhile\src\srvc_aware.c:881]: (error) Uninitialized variable: ret
[close]
Sametime - warnings
[Miranda NG\protocols\Sametime\src\glib\giowin32.c:602]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Sametime\src\glib\giowin32.c:671]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Sametime\src\glib\gslist.c:366] -> [Miranda NG\protocols\Sametime\src\glib\gslist.c:369]: (warning) Possible null pointer dereference: last - otherwise it is redundant to check it against null.
[Miranda NG\protocols\Sametime\src\glib\gslice.c:1270]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'.
[Miranda NG\protocols\Sametime\src\glib\gslice.c:1275]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'.
[Miranda NG\protocols\Sametime\src\glib\gslice.c:1275]: (warning) %u in format string (no. 3) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'.
[Miranda NG\protocols\Sametime\src\glib\gslice.c:1280]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'size_t {aka unsigned long}'.
[Miranda NG\protocols\Sametime\src\glib\gslice.c:628] -> [Miranda NG\protocols\Sametime\src\glib\gslice.c:629]: (warning) Possible null pointer dereference: current - otherwise it is redundant to check it against null.
[Miranda NG\protocols\Sametime\src\glib\libcharset\localcharset.c:423]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'ULONG {aka unsigned long}'.
[Miranda NG\protocols\Sametime\src\meanwhile\src\mw_debug.c:74]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Sametime\src\meanwhile\src\session.c:761]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Sametime\src\meanwhile\src\session.c:820]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Sametime\src\meanwhile\src\st_list.c:521]: (warning) scanf without field width limits can crash with huge input data.
[Miranda NG\protocols\Sametime\src\meanwhile\src\st_list.c:561]: (warning) scanf without field width limits can crash with huge input data.
[close]



Title: Re: Cppcheck - static code analysis results
Post by: Goraf on 07 12 2014, 15:47:39
SkypeClassic
SkypeClassic - errors
[Miranda NG\protocols\SkypeClassic\src\alogon.cpp:103]: (error) Resource leak: mutex
[Miranda NG\protocols\SkypeClassic\src\alogon.cpp:122]: (error) Return value of allocation function CreateThread is not used.
[Miranda NG\protocols\SkypeClassic\src\gchat.cpp:53]: (error) Common realloc mistake: 'chats' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\gchat.cpp:74]: (error) Common realloc mistake: 'chats' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\gchat.cpp:243]: (error) Common realloc mistake: 'contactmask' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\gchat.cpp:264]: (error) Common realloc mistake: 'contactmask' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\skypeapi.cpp:383]: (error) Common realloc mistake: 'msg' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:454]: (error) Converting pointer arithmetic result to bool. The bool is always true unless there is undefined behaviour.
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:1178]: (error) Memory pointed to by 'ptr' is freed twice.
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:1197]: (error) Memory pointed to by 'ptr' is freed twice.
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:1210]: (error) Memory pointed to by 'ptr' is freed twice.
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:1215]: (error) Memory pointed to by 'ptr' is freed twice.
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:215]: (error) Allocation with malloc, strcpy doesn't release it.
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:266]: (error) Allocation with malloc, strcpy doesn't release it.
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:360]: (error) Common realloc mistake: 'ent' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:459]: (error) Common realloc mistake: 'u' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:632]: (error) Common realloc mistake: 's' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:779]: (error) Common realloc mistake: 's' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:794]: (error) Common realloc mistake: 's' nulled but not freed upon failure
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:468]: (error) Memory leak: u
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:785]: (error) Memory leak: s
[Miranda NG\protocols\SkypeClassic\src\skypeproxy\skypeproxy.c:256]: (error) Invalid number of character (() when these macros are defined: ''.
[close]
SkypeClassic - warnings
[Miranda NG\protocols\SkypeClassic\src\skypeapi.cpp:728]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:1884]: (warning) %d in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'.
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:1884]: (warning) %d in format string (no. 2) requires 'int *' but the argument type is 'unsigned int *'.
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:1884]: (warning) %d in format string (no. 3) requires 'int *' but the argument type is 'unsigned int *'.
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:1085] -> [Miranda NG\protocols\SkypeClassic\src\skype.cpp:1084]: (warning) Possible null pointer dereference: status - otherwise it is redundant to check it against null.
[Miranda NG\protocols\SkypeClassic\src\skype.cpp:1116] -> [Miranda NG\protocols\SkypeClassic\src\skype.cpp:1110]: (warning) Possible null pointer dereference: pTok - otherwise it is redundant to check it against null.
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:103] -> [Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:99]: (warning) Possible null pointer dereference: root - otherwise it is redundant to check it against null.
[Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:772] -> [Miranda NG\protocols\SkypeClassic\src\ezxml\ezxml.c:771]: (warning) Possible null pointer dereference: root - otherwise it is redundant to check it against null.
[close]

Tlen
Tlen - errors
[Miranda NG\protocols\Tlen\src\tlen_p2p_new.cpp:40]: (error) Common realloc mistake: 'str' nulled but not freed upon failure
[close]
Tlen - warnings
[Miranda NG\protocols\Tlen\src\tlen_iqid.cpp:78] -> [Miranda NG\protocols\Tlen\src\tlen_iqid.cpp:87]: (warning) Possible null pointer dereference: str - otherwise it is redundant to check it against null.
[close]

Twitter
Twitter - errors
[Miranda NG\protocols\Twitter\src\main.cpp:112]: (error) Array 'g_hEvents[1]' accessed at index 1, which is out of bounds.
[close]
Twitter - warnings
[Miranda NG\protocols\Twitter\src\ui.cpp:86]: (warning) Dangerous usage of strncat - 3rd parameter is the maximum number of characters to append.
[Miranda NG\protocols\Twitter\src\ui.cpp:237]: (warning) Dangerous usage of strncat - 3rd parameter is the maximum number of characters to append.
[close]

VKontakte
VKontakte - errors
[Miranda NG\protocols\VKontakte\src\vk.h:43]: (error) The code contains unhandled characters (character code = 0xc5). Checking continues, but do not expect valid results.
[close]

WhatsApp
WhatsApp - errors
[Miranda NG\protocols\WhatsApp\src\dialogs.cpp:170]: (error) Mismatching allocation and deallocation: value
[Miranda NG\protocols\WhatsApp\src\WhatsAPI++\utilities.cpp:179]: (error) va_list 'args' was opened but not closed by va_end().
[close]

Xfire
Xfire - errors
[Miranda NG\protocols\Xfire\src\Xfire_voicechat.cpp:356]: (error) Mismatching allocation and deallocation: ptab
[Miranda NG\protocols\Xfire\src\Xfire_voicechat.cpp:362]: (error) Mismatching allocation and deallocation: ptab
[Miranda NG\protocols\Xfire\src\addgamedialog.cpp:63]: (error) Resource leak: f
[Miranda NG\protocols\Xfire\src\options.cpp:970]: (error) Mismatching allocation and deallocation: text
[Miranda NG\protocols\Xfire\src\tools.cpp:776]: (error) Memory leak: UserPool
[Miranda NG\protocols\Xfire\src\tools.cpp:784]: (error) Memory leak: UserPool
[Miranda NG\protocols\Xfire\src\tools.cpp:792]: (error) Memory leak: UserPool
[Miranda NG\protocols\Xfire\src\tools.cpp:77]: (error) Mismatching allocation and deallocation: temp
[close]
Xfire - warnings
[Miranda NG\protocols\Xfire\src\addgamedialog.cpp:104] -> [Miranda NG\protocols\Xfire\src\addgamedialog.cpp:97]: (warning) Possible null pointer dereference: p - otherwise it is redundant to check it against null.
[Miranda NG\protocols\Xfire\src\sendgamestatus2packet.h:44] -> [Miranda NG\protocols\Xfire\src\sendgamestatuspacket.h:43]: (warning) The class 'SendGameStatus2Packet' defines member variable with name 'gameid' also defined in its parent class 'SendGameStatusPacket'.
[Miranda NG\protocols\Xfire\src\sendgamestatus2packet.h:45] -> [Miranda NG\protocols\Xfire\src\sendgamestatuspacket.h:44]: (warning) The class 'SendGameStatus2Packet' defines member variable with name 'ip' also defined in its parent class 'SendGameStatusPacket'.
[Miranda NG\protocols\Xfire\src\sendgamestatus2packet.h:46] -> [Miranda NG\protocols\Xfire\src\sendgamestatuspacket.h:45]: (warning) The class 'SendGameStatus2Packet' defines member variable with name 'port' also defined in its parent class 'SendGameStatusPacket'.
[Miranda NG\protocols\Xfire\src\authpacket.cpp:39]: (warning) Possible leak in public function. The pointer 'salt' is not deallocated before it is allocated.
[Miranda NG\protocols\Xfire\src\buddyinfo.cpp:42]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'int'.
[Miranda NG\protocols\Xfire\src\clanbuddylistnamespacket.cpp:54]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'int'.
[Miranda NG\protocols\Xfire\src\clanbuddylistnamespacket.cpp:69]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'int'.
[Miranda NG\protocols\Xfire\src\clanbuddylistnamespacket.cpp:77]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'char'.
[Miranda NG\protocols\Xfire\src\clanbuddylistnamespacket.cpp:78]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'char'.
[Miranda NG\protocols\Xfire\src\clanbuddylistnamespacket.cpp:82]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'char'.
[Miranda NG\protocols\Xfire\src\clanbuddylistnamespacket.cpp:83]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'char'.
[Miranda NG\protocols\Xfire\src\friendsoffriendlist.cpp:53]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'int'.
[Miranda NG\protocols\Xfire\src\friendsoffriendlist.cpp:58]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'int'.
[Miranda NG\protocols\Xfire\src\loginsuccesspacket.cpp:41]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'long'.
[Miranda NG\protocols\Xfire\src\loginsuccesspacket.cpp:53]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
[Miranda NG\protocols\Xfire\src\searching4games.cpp:293] -> [Miranda NG\protocols\Xfire\src\searching4games.cpp:294]: (warning) Possible null pointer dereference: pos - otherwise it is redundant to check it against null.
[Miranda NG\protocols\Xfire\src\sendsidpacket.cpp:48]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'size_t {aka unsigned long}'.
[Miranda NG\protocols\Xfire\src\sendsidpacket.cpp:53]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
[Miranda NG\protocols\Xfire\src\tools.cpp:728]: (warning) Signed 'char' type used as array index.
[Miranda NG\protocols\Xfire\src\tools.cpp:734]: (warning) Signed 'char' type used as array index.
[Miranda NG\protocols\Xfire\src\tools.cpp:740]: (warning) Signed 'char' type used as array index.
[Miranda NG\protocols\Xfire\src\xfirefoundbuddys.cpp:53]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'int'.
[Miranda NG\protocols\Xfire\src\xfirefoundbuddys.cpp:81]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'int'.
[close]

Yahoo
Yahoo - errors
[Miranda NG\protocols\Yahoo\src\avatar.cpp:823]: (error) Resource leak: hFile
[Miranda NG\protocols\Yahoo\src\avatar.cpp:839]: (error) Resource leak: hFile
[Miranda NG\protocols\Yahoo\src\libyahoo2\yahoo_util.h:105]: (error) Invalid number of character ({) when these macros are defined: 'HAVE_GLIB'.
[Miranda NG\protocols\Yahoo\src\libyahoo2\crypt.cpp:160]: (error) Possible null pointer dereference: buffer
[Miranda NG\protocols\Yahoo\src\libyahoo2\crypt.cpp:161]: (error) Possible null pointer dereference: buffer
[Miranda NG\protocols\Yahoo\src\libyahoo2\yahoo_httplib.cpp:178]: (error) Common realloc mistake: 'str' nulled but not freed upon failure
[Miranda NG\protocols\Yahoo\src\libyahoo2\yahoo_httplib.cpp:218]: (error) Common realloc mistake: 'str' nulled but not freed upon failure
[Miranda NG\protocols\Yahoo\src\libyahoo2\yahoo_httplib.cpp:275]: (error) Common realloc mistake: 'str' nulled but not freed upon failure
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:2433]: (error) Memory leak: magic_hash
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:793]: (error) Undefined behavior: Variable 'z' is used as parameter and destination in s[n]printf().
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:796]: (error) Undefined behavior: Variable 'z' is used as parameter and destination in s[n]printf().
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:798]: (error) Undefined behavior: Variable 'z' is used as parameter and destination in s[n]printf().
[close]
Yahoo - warnings
[Miranda NG\protocols\Yahoo\src\file_transfer.cpp:146]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Yahoo\src\libyahoo2\yahoo_util.cpp:50]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Yahoo\src\libyahoo2\yahoo_util.cpp:116]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:690]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:713]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:1032]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:1097]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:735] -> [Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:5135]: (warning) Possible null pointer dereference: pkt - otherwise it is redundant to check it against null.
[Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:1261] -> [Miranda NG\protocols\Yahoo\src\libyahoo2\libyahoo2.cpp:1259]: (warning) Possible null pointer dereference: from - otherwise it is redundant to check it against null.
[close]
Title: Re: Cppcheck - static code analysis results
Post by: Wishmaster on 13 12 2014, 10:45:41
Hi,
I fixed some of them, none had a bigger impact.
You can safely ignore all  "Resource leak" warnings, e.g.
Quote
[Miranda NG\src\mir_core\protos.cpp:254]: (error) Resource leak: hFile
See the code:
Code: [Select]
HANDLE hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return PA_FORMAT_UNKNOWN;
No need to close a handle in this case.


More interesting are the warnings of that kind:
Quote
[Miranda NG\protocols\IRCG\src\output.cpp:79]: (warning) Logical disjunction always evaluates to true: index > 400 || index < 500.
[Miranda NG\protocols\IRCG\src\output.cpp:142]: (warning) Logical disjunction always evaluates to true: iTemp > 400 || iTemp < 500.
Hm, what did the author really intendo to do there?
Title: Re: Cppcheck - static code analysis results
Post by: White-Tiger on 13 12 2014, 14:10:16
[...]
More interesting are the warnings of that kind:Hm, what did the author really intendo to do there?
From that code it looks like IRC sometimes sends status codes... and some above 400 seem to be errors or something...
If you take this code:
Code: [Select]
if ((index > 400 || index < 500) && pmsg->parameters.getCount() > 2 && pmsg->sCommand[0] == '4') //all error messagesit can actually only evaluate to true if the command is a number between 400 and 499
So "(index >= 400 && index < 500)" would be fine (without that "if first char = 4" check)
The command string was also previously converted to an integer..
Code: [Select]
int index = StrToInt(pmsg->sCommand.c_str());