diff options
| author | 2020-12-21 22:09:42 -0800 | |
|---|---|---|
| committer | 2021-06-22 01:29:05 +0200 | |
| commit | b086d0612740978c1942c1c3a078d4a0b8ffffef (patch) | |
| tree | 46484950e8e6dbf2fb5d773a84b5bb73fc313bf7 /src/Dictionary.cpp | |
| parent | 526c10436caa894fb6139f4e6c0f73eebfa858ea (diff) | |
| download | libplist-b086d0612740978c1942c1c3a078d4a0b8ffffef.tar.gz libplist-b086d0612740978c1942c1c3a078d4a0b8ffffef.tar.bz2 | |
[clang-tidy] cpp: Replace free with delete
It's the C++ way. It also avoids having to check for NULL.
Found with cppcoreguidelines-owning-memory
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src/Dictionary.cpp')
| -rw-r--r-- | src/Dictionary.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Dictionary.cpp b/src/Dictionary.cpp index 20e9710..ea04e81 100644 --- a/src/Dictionary.cpp +++ b/src/Dictionary.cpp | |||
| @@ -39,7 +39,7 @@ static void dictionary_fill(Dictionary *_this, std::map<std::string,Node*> &map, | |||
| 39 | plist_dict_next_item(node, it, &key, &subnode); | 39 | plist_dict_next_item(node, it, &key, &subnode); |
| 40 | if (key && subnode) | 40 | if (key && subnode) |
| 41 | map[std::string(key)] = Node::FromPlist(subnode, _this); | 41 | map[std::string(key)] = Node::FromPlist(subnode, _this); |
| 42 | free(key); | 42 | delete key; |
| 43 | } while (subnode); | 43 | } while (subnode); |
| 44 | free(it); | 44 | free(it); |
| 45 | } | 45 | } |
| @@ -156,7 +156,7 @@ void Dictionary::Remove(Node* node) | |||
| 156 | plist_dict_get_item_key(node->GetPlist(), &key); | 156 | plist_dict_get_item_key(node->GetPlist(), &key); |
| 157 | plist_dict_remove_item(_node, key); | 157 | plist_dict_remove_item(_node, key); |
| 158 | std::string skey = key; | 158 | std::string skey = key; |
| 159 | free(key); | 159 | delete key; |
| 160 | _map.erase(skey); | 160 | _map.erase(skey); |
| 161 | delete node; | 161 | delete node; |
| 162 | } | 162 | } |
