nv50/ir: fix leak in removal of graph root
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 14 Oct 2011 17:47:45 +0000 (19:47 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 21 Oct 2011 21:00:38 +0000 (23:00 +0200)
src/gallium/drivers/nv50/codegen/nv50_ir_graph.cpp

index e987706e4150ec497fb9e2933f69c9f914ddf84c..2c64a140f513eb4de7f60e010896d0eb01a41c76 100644 (file)
@@ -145,16 +145,16 @@ bool Graph::Node::detach(Graph::Node *node)
 // Cut a node from the graph, deleting all attached edges.
 void Graph::Node::cut()
 {
-   if (!graph || (!in && !out))
-      return;
-
    while (out)
       delete out;
    while (in)
       delete in;
 
-   if (graph->root == this)
-      graph->root = NULL;
+   if (graph) {
+      if (graph->root == this)
+         graph->root = NULL;
+      graph = NULL;
+   }
 }
 
 Graph::Edge::Edge(Node *org, Node *tgt, Type kind)