16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 00:09:18 +02:00

fixed some potential memory leaks and other errors detected by cppcheck

This commit is contained in:
tmj-fstate
2017-01-16 13:26:36 +01:00
parent 15cf3d73a8
commit 68e5dd84e0
18 changed files with 202 additions and 155 deletions

View File

@@ -208,7 +208,7 @@ std::string TrimSpace(std::string &s, int Just)
char* TrimAndReduceSpaces(const char* s)
{ // redukuje spacje pomiedzy znakami do jednej
char* tmp;
char* tmp = nullptr;
if (s)
{
@@ -422,11 +422,11 @@ int stol_def(const std::string &str, const int &DefaultValue)
std::strncpy(s, str.c_str(), len);
char *p;
int result = strtol(s, &p, 0);
if ((*p != '\0') || (errno != 0))
delete[] s;
if( ( *p != '\0' ) || ( errno != 0 ) )
{
return DefaultValue;
}
delete s;
return result;
}