diff mbox series

[ovs-dev] ofp-port: Free memory on error in ofp_print_ofpst_port_reply

Message ID 1539897049-5070-1-git-send-email-pkusunyifeng@gmail.com
State Accepted
Headers show
Series [ovs-dev] ofp-port: Free memory on error in ofp_print_ofpst_port_reply | expand

Commit Message

Yifeng Sun Oct. 18, 2018, 9:10 p.m. UTC
Counters in ops->custom_stats may already be valid at this error point.
This patch frees the leaked memory.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10322
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
 lib/ofp-port.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ben Pfaff Oct. 23, 2018, 4:30 p.m. UTC | #1
On Thu, Oct 18, 2018 at 02:10:47PM -0700, Yifeng Sun wrote:
> Counters in ops->custom_stats may already be valid at this error point.
> This patch frees the leaked memory.
> 
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10322
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>

Thanks, applied and backported.
diff mbox series

Patch

diff --git a/lib/ofp-port.c b/lib/ofp-port.c
index 3d1ada9ceb99..15dac4f0ac2e 100644
--- a/lib/ofp-port.c
+++ b/lib/ofp-port.c
@@ -1679,6 +1679,7 @@  ofputil_pull_ofp14_port_stats(struct ofputil_port_stats *ops,
 
         error = ofpprop_pull(&properties, &payload, &type);
         if (error) {
+            netdev_free_custom_stats_counters(&ops->custom_stats);
             return error;
         }
         switch (type) {