Safe list iteration in kconsumerd: protect against free()
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 8 Aug 2011 04:31:41 +0000 (00:31 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 8 Aug 2011 04:31:41 +0000 (00:31 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttkconsumerd/liblttkconsumerd.c

index f60888a83fc8f5ebc5758155770876973216c01e..a135570fd5c2fe1efebd3c69d443e75e25e949ba 100644 (file)
@@ -1004,7 +1004,7 @@ end:
  */
 void kconsumerd_cleanup(void)
 {
-       struct kconsumerd_fd *iter;
+       struct kconsumerd_fd *iter, *tmp;
 
        /* remove the socket file */
        unlink(kconsumerd_command_sock_path);
@@ -1014,7 +1014,7 @@ void kconsumerd_cleanup(void)
         * running (after joining on the threads), no need to protect
         * list iteration with mutex.
         */
-       cds_list_for_each_entry(iter, &kconsumerd_data.fd_list.head, list) {
+       cds_list_for_each_entry_safe(iter, tmp, &kconsumerd_data.fd_list.head, list) {
                kconsumerd_del_fd(iter);
        }
 }
This page took 0.026672 seconds and 5 git commands to generate.