You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Fix a few cppcheck issues
Found the following: * Potential stack explosions with alloca() usage on potentially large strings * Memory leaks in WriteEngineServer * Stack usage out of scope in dataconvert * A typo in an 'if' statement in dataconvert
This commit is contained in:
@ -81,8 +81,7 @@ std::string Func_repeat::getStrVal(rowgroup::Row& row,
|
||||
int size = str.length() * count;
|
||||
|
||||
//allocate memory
|
||||
char* result = NULL;
|
||||
result = (char*) alloca(size * sizeof(char) + 1);
|
||||
char* result = new char[size + 1];
|
||||
|
||||
if (result == NULL)
|
||||
{
|
||||
@ -97,7 +96,9 @@ std::string Func_repeat::getStrVal(rowgroup::Row& row,
|
||||
return "";
|
||||
}
|
||||
|
||||
return result;
|
||||
std::string res(result);
|
||||
delete [] result;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user