diff --git a/src/ini_load.cpp b/src/ini_load.cpp --- a/src/ini_load.cpp +++ b/src/ini_load.cpp @@ -63,7 +63,8 @@ IniGroup::IniGroup(IniLoadFile *parent, 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;