ofproto-dpif-xlate: Fix freeing uninitialized "struct ofpbuf".
authorAlex Wang <alexw@nicira.com>
Fri, 11 Oct 2013 21:17:13 +0000 (14:17 -0700)
committerEthan Jackson <ethan@nicira.com>
Fri, 11 Oct 2013 21:21:06 +0000 (14:21 -0700)
Commit 91d6cd12 (ofproto-dpif: Move send_packet() to
ofproto-dpif-xlate module.) introduced a bug that frees the "struct
ofpbuf" in 'xout' when the struct is not initialized.  This commit
fixes the bug.

Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
ofproto/ofproto-dpif-xlate.c

index 4fb0d5e..0e248eb 100644 (file)
@@ -2879,9 +2879,8 @@ xlate_send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet)
     ovs_rwlock_rdlock(&xlate_rwlock);
     xport = xport_lookup(ofport);
     if (!xport) {
-        error = EINVAL;
         ovs_rwlock_unlock(&xlate_rwlock);
-        goto out;
+        return EINVAL;
     }
 
     odp_flow_key_from_flow(&key, &flow, ofp_port_to_odp_port(xport->xbridge, OFPP_LOCAL));
@@ -2899,8 +2898,6 @@ xlate_send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet)
                          xout.odp_actions.data, xout.odp_actions.size,
                          packet, (xout.slow & SLOW_ACTION) != 0);
     ovs_rwlock_unlock(&xlate_rwlock);
-
-out:
     xlate_out_uninit(&xout);
     return error;
 }