[ovs-dev] [PATCH] ofp-port: Don't leak on error in ofputil_pull_ofp14_port_stats().

Justin Pettit jpettit at ovn.org
Fri Sep 14 21:43:29 UTC 2018


With this change, we can remove a case of free done in the error code
path.

Signed-off-by: Justin Pettit <jpettit at ovn.org>
---
 lib/ofp-port.c  | 1 +
 lib/ofp-print.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ofp-port.c b/lib/ofp-port.c
index ec70f46e96bb..3d1ada9ceb99 100644
--- a/lib/ofp-port.c
+++ b/lib/ofp-port.c
@@ -1697,6 +1697,7 @@ ofputil_pull_ofp14_port_stats(struct ofputil_port_stats *ops,
         }
 
         if (error) {
+            netdev_free_custom_stats_counters(&ops->custom_stats);
             return error;
         }
     }
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 37d7b8b98c55..e05a969a82b0 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -558,7 +558,6 @@ ofp_print_ofpst_port_reply(struct ds *string, const struct ofp_header *oh,
 
         retval = ofputil_decode_port_stats(&ps, &b);
         if (retval) {
-            netdev_free_custom_stats_counters(&ps.custom_stats);
             return retval != EOF ? retval : 0;
         }
         ofputil_format_port_stats(string, &ps, port_map);
-- 
2.17.1



More information about the dev mailing list