mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r26476) -Fix: prevent comparing to NULL when strndup could not allocate memory
This commit is contained in:
parent
bbed2ff956
commit
4b355534c0
|
@ -63,7 +63,8 @@ IniGroup::IniGroup(IniLoadFile *parent, const char *name, size_t len) : next(NUL
|
|||
if (len == 0) len = strlen(name);
|
||||
|
||||
this->name = strndup(name, len);
|
||||
if (this->name != NULL) str_validate(this->name, this->name + len);
|
||||
if (this->name == NULL) error("not enough memory to allocate group name");
|
||||
str_validate(this->name, this->name + len);
|
||||
|
||||
this->last_item = &this->item;
|
||||
*parent->last_group = this;
|
||||
|
|
Loading…
Reference in New Issue