aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/parser/grammar.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/engines/sci/parser/grammar.cpp b/engines/sci/parser/grammar.cpp
index 6e02eb75e3..26e3ec9238 100644
--- a/engines/sci/parser/grammar.cpp
+++ b/engines/sci/parser/grammar.cpp
@@ -386,8 +386,10 @@ ParseRuleList *Vocabulary::buildGNF(bool verbose) {
for (uint i = 1; i < _parserBranches.size(); i++) { // branch rule 0 is treated specially
ParseRule *rule = _vbuild_rule(&_parserBranches[i]);
- if (!rule)
+ if (!rule) {
+ freeRuleList(ntlist);
return NULL;
+ }
ntlist = _vocab_add_rule(ntlist, rule);
}