diff options
author | Eugene Sandulenko | 2016-07-30 20:52:18 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 3fb7f5ac7bf02ae88026be59daed02475af4149f (patch) | |
tree | d4cc925d49a8ba9466d92230bf24c8934b9cbefa /engines/director/lingo | |
parent | ba3cf6181c06ddcd543db277d1fe5a6d4506cad7 (diff) | |
download | scummvm-rg350-3fb7f5ac7bf02ae88026be59daed02475af4149f.tar.gz scummvm-rg350-3fb7f5ac7bf02ae88026be59daed02475af4149f.tar.bz2 scummvm-rg350-3fb7f5ac7bf02ae88026be59daed02475af4149f.zip |
DIRECTOR: Lingo: Plug memory leak at assignment
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index fa7642651f..ab42c0d3de 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -175,15 +175,20 @@ void Lingo::c_assign() { if (d1.u.sym->type == STRING) // Free memory if needed delete d1.u.sym->u.s; - if (d2.type == INT) + if (d1.u.sym->type == POINT || d1.u.sym->type == RECT || d1.u.sym->type == ARRAY) + delete d1.u.sym->u.arr; + + if (d2.type == INT) { d1.u.sym->u.i = d2.u.i; - else if (d2.type == FLOAT) + } else if (d2.type == FLOAT) { d1.u.sym->u.f = d2.u.f; - else if (d2.type == STRING) + } else if (d2.type == STRING) { d1.u.sym->u.s = new Common::String(*d2.u.s); - else if (d2.type == POINT) - d1.u.sym->u.arr = d2.u.arr; - else if (d2.type == SYMBOL) + delete d2.u.s; + } else if (d2.type == POINT) { + d1.u.sym->u.arr = new FloatArray(*d2.u.arr); + delete d2.u.arr; + } else if (d2.type == SYMBOL) { d1.u.sym->u.i = d2.u.i; else error("c_assign: unhandled type: %s", d2.type2str()); |