Fix crash when no actions are specified.
authorJustin Pettit <jpettit@nicira.com>
Sat, 13 Sep 2008 01:47:29 +0000 (18:47 -0700)
committerJustin Pettit <jpettit@nicira.com>
Sat, 13 Sep 2008 01:47:29 +0000 (18:47 -0700)
Actions are allocated as a pointer to an array of actions in flows.  When
flows are freed, the code was always freeing the action pointer.
Under some circumstances the pointer may not be set.

datapath/flow.c
switch/switch-flow.c

index a2c96ab..71dd823 100644 (file)
@@ -187,7 +187,8 @@ void flow_free(struct sw_flow *flow)
 {
        if (unlikely(!flow))
                return;
-       kfree(flow->actions);
+       if (flow->actions)
+               kfree(flow->actions);
        kmem_cache_free(flow_cache, flow);
 }
 EXPORT_SYMBOL(flow_free);
index 9c9538d..16a7177 100644 (file)
@@ -191,7 +191,9 @@ flow_free(struct sw_flow *flow)
     if (!flow) {
         return; 
     }
-    free(flow->actions);
+    if (flow->actions) {
+        free(flow->actions);
+    }
     free(flow);
 }