[ovs-dev] [netlink v3 15/16] dpif: Eliminate "struct odp_port" from client-visible interface.
Ben Pfaff
blp at nicira.com
Wed Jan 12 22:09:31 UTC 2011
On Tue, Jan 11, 2011 at 05:52:21PM -0800, Justin Pettit wrote:
> On Dec 29, 2010, at 4:56 PM, Ben Pfaff wrote:
>
> > static int
> > dpif_netdev_port_dump_next(const struct dpif *dpif, void *state_,
> > - struct odp_port *odp_port)
> > + struct dpif_port *dpif_port)
> > {
> > struct dp_netdev_port_state *state = state_;
> > struct dp_netdev *dp = get_dp_netdev(dpif);
> > @@ -561,7 +561,10 @@ dpif_netdev_port_dump_next(const struct dpif *dpif, void *state_,
> > for (port_no = state->port_no; port_no < MAX_PORTS; port_no++) {
> > struct dp_netdev_port *port = dp->ports[port_no];
> > if (port) {
> > - answer_port_query(port, odp_port);
> > + free(state->name);
>
> I don't see where "state->name" is ever set. Is it even needed? If
> so, it seems like it may be safer to set it to NULL, since the way
> "state" is used it seems ripe for a double-free.
Oops, that's a memory leak there. state->name needs to be set to the
string that weput in dpif_port->name so that we can free it on the next
iteration (the name is owned by the dpif).
Thanks,
Ben.
More information about the dev
mailing list