(svn r26509) -Codechange: replace strdup with stredup (the latter ensures the return is not NULL)

This commit is contained in:
rubidium
2014-04-25 15:40:32 +00:00
parent 0b159549d4
commit 034735a54c
70 changed files with 207 additions and 183 deletions

View File

@@ -26,7 +26,7 @@ template <class CL, ScriptType ST> const char *GetClassName();
namespace SQConvert {
/**
* Pointers assigned to this class will be free'd when this instance
* comes out of scope. Useful to make sure you can use strdup(),
* comes out of scope. Useful to make sure you can use stredup(),
* without leaking memory.
*/
struct SQAutoFreePointers : SmallVector<void *, 1> {
@@ -113,7 +113,7 @@ namespace SQConvert {
const SQChar *tmp;
sq_getstring(vm, -1, &tmp);
char *tmp_str = strdup(SQ2OTTD(tmp));
char *tmp_str = stredup(SQ2OTTD(tmp));
sq_poptop(vm);
*ptr->Append() = (void *)tmp_str;
str_validate(tmp_str, tmp_str + strlen(tmp_str));