Skip to content

Commit 1848d37

Browse files
committed
fm-tree-model: Fix use of memory after it is freed
to avoid warning with Clang Analyzer
1 parent 7c9ae01 commit 1848d37

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/file-manager/fm-tree-model.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,9 +779,13 @@ stop_monitoring_directory (FMTreeModel *model, TreeNode *node)
779779
static void
780780
destroy_children_without_reporting (FMTreeModel *model, TreeNode *parent)
781781
{
782-
while (parent->first_child != NULL)
782+
TreeNode *current_child = parent->first_child;
783+
TreeNode *next_child;
784+
while (current_child != NULL)
783785
{
784-
destroy_node_without_reporting (model, parent->first_child);
786+
next_child = current_child->next;
787+
destroy_node_without_reporting (model, current_child);
788+
current_child = next_child;
785789
}
786790
}
787791

0 commit comments

Comments
 (0)