ofproto: Fix memory leak and memory exhaustion bugs in group_mod.
In handle_group_mod() cases where adding a group failed, nothing freed the list of buckets, causing a leak. The same was true in every case of modifying a group. This commit fixes the problem by changing add_group() to never steal or free the buckets (modify_group() already acted this way) and then making handle_group_mod() always free the buckets when it's done. This approach might at first raise objections, because it makes add_group() copy the buckets instead of just take the existing ones. On branch-2.5 and master, there's a good reason for that--please see the original commit for explanation. On this backport to branch-2.4, though, we just use this approach to avoid having to carefully write a new version for the backport. Found by pain and suffering. Signed-off-by: Ben Pfaff <email@example.com> Acked-by: Jarno Rajahalme <firstname.lastname@example.org>
Showing with 24 additions and 12 deletions