summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-02-24 21:22:40 +0100
committerZenWalker <[email protected]>2019-03-04 12:53:01 +0100
commit297aacb483ba2296dc2ccdfba8a3af7ec333e19e (patch)
tree0f93bd29b162df3557e3656f74fb72bca6c0c115
parent961af3468a5ac1e17f6af93c490093a7e6e431ae (diff)
downloadcaja-297aacb483ba2296dc2ccdfba8a3af7ec333e19e.tar.bz2
caja-297aacb483ba2296dc2ccdfba8a3af7ec333e19e.tar.xz
fm-tree-model: Fix use of memory after it is freed
to avoid warning with Clang Analyzer
-rw-r--r--src/file-manager/fm-tree-model.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index 500b905a..ed4fc6e7 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -779,9 +779,13 @@ stop_monitoring_directory (FMTreeModel *model, TreeNode *node)
static void
destroy_children_without_reporting (FMTreeModel *model, TreeNode *parent)
{
- while (parent->first_child != NULL)
+ TreeNode *current_child = parent->first_child;
+ TreeNode *next_child;
+ while (current_child != NULL)
{
- destroy_node_without_reporting (model, parent->first_child);
+ next_child = current_child->next;
+ destroy_node_without_reporting (model, current_child);
+ current_child = next_child;
}
}