forked from hercules-team/augeas
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aug_rm: fix segfault when deleting a tree and one of its ancestors
In a tree like /files/1/2, when we execute 'rm /files//*', the path expression matches /files/1 and /files/1/2. When tree_rm goes to delete these two nodes, it first deletes (frees) /files/1 and all its descendents. By the time we try to delete /files/1/2, the pointer we have to that is no longer valid and we end up causing a double-free. With this change, we make sure we only delete a node if none of its ancestors is being deleted beforehand in the same operation - deleting a node, and one of its ancestors afterwards is fine as the pointer to the ancestor is still valid. Fixes hercules-team#319 Special shoutout to Geoff Williams for finding, diagnosing and filing a great bug report about this.
- Loading branch information
Showing
3 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters