Silence use-after-free static analysis warning
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 5 Sep 2015 15:35:43 +0000 (11:35 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 5 Sep 2015 15:36:28 +0000 (11:36 -0400)
clang-analyzer complains that cds_list_for_each_entry_safe()
makes use of "wait_node" after free. However, wait_node is only
used in __typeof__().

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/main.c

index b5cfe307df0f09e1a1eec61de85795bee1de29ea..d4dae16fd43656db074bb064b2c48720710ebc7c 100644 (file)
@@ -1787,6 +1787,12 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
                                wait_queue->count--;
                                ust_app_destroy(wait_node->app);
                                free(wait_node);
+                               /*
+                                * Silence warning of use-after-free in
+                                * cds_list_for_each_entry_safe which uses
+                                * __typeof__(*wait_node).
+                                */
+                               wait_node = NULL;
                                break;
                        }
                }
This page took 0.035306 seconds and 4 git commands to generate.