[ovs-dev] [memory fixes 3/6] vswitchd: Fix dependency on DP_MAX_PORTS for allocating "struct dst"s.
Justin Pettit
jpettit at nicira.com
Mon Dec 13 21:43:56 UTC 2010
On Dec 13, 2010, at 1:10 PM, Ben Pfaff wrote:
> +static void
> +dst_set_add(struct dst_set *set, const struct dst *dst)
> +{
> + if (set->n >= set->allocated) {
> + size_t new_allocated;
> + struct dst *new_dsts;
> +
> + new_allocated = set->allocated * 2;
> + new_dsts = xmalloc(new_allocated * sizeof *new_dsts);
> + memcpy(new_dsts, set->dsts, set->n * sizeof *new_dsts);
> +
> + free(set->dsts);
Initially, this points to "set->builtin", so I don't think this is safe.
> @@ -2428,19 +2473,20 @@ compose_actions(struct bridge *br, const struct flow *flow, uint16_t vlan,
> tag_type *tags, struct ofpbuf *actions,
> uint16_t *nf_output_iface)
> {
> ...
> - for (p = dsts; p < &dsts[n_dsts]; p++) {
> + for (i = 0; i < set.n; i++) {
> + const struct dst *p = &set.dsts[i];
This is very minor, but elsewhere in the patch, you switched from using "p" to "dst".
--Justin
More information about the dev
mailing list