ofproto-dpif: Fix memory leak in handle_flow_miss().
authorBen Pfaff <blp@nicira.com>
Tue, 20 Aug 2013 14:15:39 +0000 (07:15 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 20 Aug 2013 14:15:39 +0000 (07:15 -0700)
Every xlate_actions() needs a corresponding xlate_out_uninit(), but the
call in handle_flow_miss() lacked one.  struct xlate_out has a built-in
256-byte actions stub, so the bug only showed up for lots of actions.

Bug #19198.
Reported-by: Ronald Lee <ronaldlee@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
ofproto/ofproto-dpif.c

index 20a180e..0fdd1fb 100644 (file)
@@ -3898,10 +3898,12 @@ handle_flow_miss(struct flow_miss *miss, struct flow_miss_op *ops,
         if (miss->key_fitness == ODP_FIT_TOO_LITTLE
             || !flow_miss_should_make_facet(miss, &xout.wc)) {
             handle_flow_miss_without_facet(rule, &xout, miss, ops, n_ops);
+            xlate_out_uninit(&xout);
             return;
         }
 
         facet = facet_create(miss, rule, &xout, stats);
+        xlate_out_uninit(&xout);
         stats = NULL;
     }
     handle_flow_miss_with_facet(miss, facet, now, stats, ops, n_ops);
@@ -7114,7 +7116,10 @@ xlate_out_uninit(struct xlate_out *xout)
 }
 
 /* Translates the 'ofpacts_len' bytes of "struct ofpacts" starting at 'ofpacts'
- * into datapath actions in 'odp_actions', using 'ctx'. */
+ * into datapath actions in 'odp_actions', using 'ctx'.
+ *
+ * The caller must take responsibility for eventually freeing 'xout', with
+ * xlate_out_uninit(). */
 static void
 xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
 {