(svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL)
This commit is contained in:
@@ -19,6 +19,16 @@
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
RawText::RawText(const char *text) : text(stredup(text))
|
||||
{
|
||||
}
|
||||
|
||||
RawText::~RawText()
|
||||
{
|
||||
free(this->text);
|
||||
}
|
||||
|
||||
|
||||
ScriptText::ScriptText(HSQUIRRELVM vm) :
|
||||
ZeroedMemoryAllocator()
|
||||
{
|
||||
@@ -73,7 +83,7 @@ SQInteger ScriptText::_SetParam(int parameter, HSQUIRRELVM vm)
|
||||
const SQChar *value;
|
||||
sq_getstring(vm, -1, &value);
|
||||
|
||||
this->params[parameter] = strdup(SQ2OTTD(value));
|
||||
this->params[parameter] = stredup(SQ2OTTD(value));
|
||||
ValidateString(this->params[parameter]);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user