summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-02-24 21:22:40 +0100
committerPablo Barciela <[email protected]>2019-03-05 01:20:06 +0100
commit1848d37c4ddb0d4d5b20f5bbb99b94e22aae68e7 (patch)
tree5f7d01d1a601f182de93a5c4eca147e16f2d1082
parent7c9ae01aaee4583eb0ca979dc3a07b6ae585a90d (diff)
downloadcaja-1848d37c4ddb0d4d5b20f5bbb99b94e22aae68e7.tar.bz2
caja-1848d37c4ddb0d4d5b20f5bbb99b94e22aae68e7.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;
}
}