llvm.org GIT mirror llvm / 4789642
Fix memory leak introduced in r237314. The commit r237314 that implements YAML block parsing introduced a leak that was caught by the ASAN linux buildbot. YAML Parser stores its tokens in an ilist, and allocates tokens using a BumpPtrAllocator, but doesn't call the destructor for the allocated tokens. R237314 added an std::string field to a Token which leaked as the Token's destructor wasn't called. This commit fixes this leak by calling the Token's destructor when a Token is being removed from an ilist of tokens. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237389 91177308-0d34-0410-b5e6-96231b3b80d8 Alex Lorenz 4 years ago
1 changed file(s) with 1 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
167167 Token *createNode(const Token &V) {
168168 return new (Alloc.Allocate()) Token(V);
169169 }
170 static void deleteNode(Token *V) {}
170 static void deleteNode(Token *V) { V->~Token(); }
171171
172172 void addNodeToList(Token *) {}
173173 void removeNodeFromList(Token *) {}