mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 04:01:23 +00:00
Fixed leak when using SearchSet::add for an already existing name.
svn-id: r34928
This commit is contained in:
parent
1512fbd261
commit
4cc5015fd0
@ -299,17 +299,19 @@ void SearchSet::insert(const Node &node) {
|
||||
_list.insert(it, node);
|
||||
}
|
||||
|
||||
void SearchSet::add(const String& name, Archive *archive, int priority, bool autoFree) {
|
||||
void SearchSet::add(const String &name, Archive *archive, int priority, bool autoFree) {
|
||||
if (find(name) == _list.end()) {
|
||||
Node node(priority, name, archive, autoFree);
|
||||
insert(node);
|
||||
} else {
|
||||
if (autoFree)
|
||||
delete archive;
|
||||
warning("SearchSet::add: archive '%s' already present", name.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SearchSet::remove(const String& name) {
|
||||
void SearchSet::remove(const String &name) {
|
||||
ArchiveList::iterator it = find(name);
|
||||
if (it != _list.end()) {
|
||||
if (it->_autoFree)
|
||||
@ -331,7 +333,7 @@ void SearchSet::clear() {
|
||||
_list.clear();
|
||||
}
|
||||
|
||||
void SearchSet::setPriority(const String& name, int priority) {
|
||||
void SearchSet::setPriority(const String &name, int priority) {
|
||||
ArchiveList::iterator it = find(name);
|
||||
if (it == _list.end()) {
|
||||
warning("SearchSet::setPriority: archive '%s' is not present", name.c_str());
|
||||
|
Loading…
x
Reference in New Issue
Block a user