ofproto-dpif: Fix memory leak.
authorPravin B Shelar <pshelar@nicira.com>
Wed, 30 Nov 2011 22:17:15 +0000 (14:17 -0800)
committerPravin B Shelar <pshelar@nicira.com>
Wed, 30 Nov 2011 22:17:15 +0000 (14:17 -0800)
Following patch fixes memory leak in case there is ODP_FIT_ERROR
on flow key.

ofproto/ofproto-dpif.c

index 14b5447..57534e3 100644 (file)
@@ -2573,6 +2573,7 @@ handle_miss_upcalls(struct ofproto_dpif *ofproto, struct dpif_upcall *upcalls,
                                                 upcall->key, upcall->key_len,
                                                 &flow, &initial_tci);
         if (fitness == ODP_FIT_ERROR) {
+            ofpbuf_delete(upcall->packet);
             continue;
         }
         flow_extract(upcall->packet, flow.priority, flow.tun_id,
@@ -2649,6 +2650,7 @@ handle_userspace_upcall(struct ofproto_dpif *ofproto,
                                             upcall->key_len, &flow,
                                             &initial_tci);
     if (fitness == ODP_FIT_ERROR) {
+        ofpbuf_delete(upcall->packet);
         return;
     }
 
@@ -2664,6 +2666,7 @@ handle_userspace_upcall(struct ofproto_dpif *ofproto,
                               &flow, false);
     } else {
         VLOG_WARN_RL(&rl, "invalid user cookie : 0x%"PRIx64, upcall->userdata);
+        ofpbuf_delete(upcall->packet);
     }
 }