diff options
author | rubidium <rubidium@openttd.org> | 2014-04-20 16:43:22 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-04-20 16:43:22 +0000 |
commit | 4b355534c0e1bea1801393a18593c51b7f211278 (patch) | |
tree | a61f4131438e54acdf014ded61548a9ff2366319 /src | |
parent | bbed2ff9563ed102e538b512282b645c1e3ef7b6 (diff) | |
download | openttd-4b355534c0e1bea1801393a18593c51b7f211278.tar.xz |
(svn r26476) -Fix: prevent comparing to NULL when strndup could not allocate memory
Diffstat (limited to 'src')
-rw-r--r-- | src/ini_load.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ini_load.cpp b/src/ini_load.cpp index 158ffa6a7..75a825453 100644 --- a/src/ini_load.cpp +++ b/src/ini_load.cpp @@ -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; |