diff options
Diffstat (limited to 'engines/saga/saga.cpp')
-rw-r--r-- | engines/saga/saga.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp index 13567f67b5..1643ecfa17 100644 --- a/engines/saga/saga.cpp +++ b/engines/saga/saga.cpp @@ -426,10 +426,11 @@ void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPoin if (offset == stringsLength) { stringsCount = i; const char **tmp = (const char **)realloc(stringsTable.strings, stringsCount * sizeof(*stringsTable.strings)); - if (tmp) + if ((tmp != NULL) || (stringsCount == 0)) { stringsTable.strings = tmp; - else + } else { error("SagaEngine::loadStrings() Error while reallocating memory"); + } break; } if (offset > stringsLength) { @@ -438,10 +439,11 @@ void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPoin warning("SagaEngine::loadStrings wrong strings table"); stringsCount = i; const char **tmp = (const char **)realloc(stringsTable.strings, stringsCount * sizeof(*stringsTable.strings)); - if (tmp) + if ((tmp != NULL) || (stringsCount == 0)) { stringsTable.strings = tmp; - else + } else { error("SagaEngine::loadStrings() Error while reallocating memory"); + } break; } stringsTable.strings[i] = (const char *)stringsTable.stringsPointer + offset; |