mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
TITANIC: Fix memory leak
TTsynonym constructor copies the value of the incoming string, it does not take ownership. Coverity CID 1361031
This commit is contained in:
parent
fa6454ef4f
commit
23901f22ee
@ -39,8 +39,8 @@ TTsynonym::TTsynonym(int mode, const char *str, FileHandle file) :
|
||||
_file = file;
|
||||
}
|
||||
|
||||
TTsynonym::TTsynonym(int mode, TTstring *str) : TTstringNode() {
|
||||
_string = *str;
|
||||
TTsynonym::TTsynonym(int mode, const TTstring &str) : TTstringNode() {
|
||||
_string = str;
|
||||
initialize(mode);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
TTsynonym();
|
||||
TTsynonym(const TTsynonym *src);
|
||||
TTsynonym(int mode, const char *str, FileHandle file);
|
||||
TTsynonym(int mode, TTstring *str);
|
||||
TTsynonym(int mode, const TTstring &str);
|
||||
|
||||
/**
|
||||
* Copies data from one synonym to another
|
||||
|
@ -120,8 +120,7 @@ int TTword::setSynStr(TTstring &str) {
|
||||
if (str.empty())
|
||||
return 4;
|
||||
|
||||
TTstring *newStr = new TTstring(str);
|
||||
TTsynonym *newSyn = new TTsynonym(4, newStr);
|
||||
TTsynonym *newSyn = new TTsynonym(4, str);
|
||||
setSyn(newSyn);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user