Skip to content

Commit

Permalink
LURE: Allocate debug strings buffer on the heap
Browse files Browse the repository at this point in the history
  • Loading branch information
Templier committed Jun 23, 2011
1 parent 8a5bda7 commit 9ff9933
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions engines/lure/debugger.cpp
Expand Up @@ -549,14 +549,19 @@ bool Debugger::cmd_showAnim(int argc, const char **argv) {
}

bool Debugger::cmd_saveStrings(int argc, const char **argv) {
StringData &strings = StringData::getReference();
char buffer[32768];

if (argc != 2) {
DebugPrintf("strings <stringId>\n");
return true;
}

StringData &strings = StringData::getReference();

char *buffer = (char *)malloc(32768);
if (!buffer) {
DebugPrintf("Cannot allocate strings buffer\n");
return true;
}

uint16 id = strToInt(argv[1]);
strings.getString(id, buffer, NULL, NULL);
DebugPrintf("%s\n", buffer);
Expand All @@ -577,6 +582,9 @@ bool Debugger::cmd_saveStrings(int argc, const char **argv) {
DebugPrintf("Done\n");
*/

free(buffer);

return true;
}

Expand Down

0 comments on commit 9ff9933

Please sign in to comment.