[ovs-dev] [PATCH] nx-match: Fix memory leak in oxm_pull_field_array() error case.

Ben Pfaff blp at ovn.org
Thu Jul 26 22:43:27 UTC 2018


Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9424
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/nx-match.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/nx-match.c b/lib/nx-match.c
index 6b1b563ea7b0..3b030833cb2c 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -742,7 +742,6 @@ oxm_pull_field_array(const void *fields_data, size_t fields_len,
                                 NULL);
         if (error) {
             VLOG_DBG_RL(&rl, "error pulling field array field");
-            return error;
         } else if (!field) {
             VLOG_DBG_RL(&rl, "unknown field array field");
             error = OFPERR_OFPBMC_BAD_FIELD;
@@ -751,7 +750,7 @@ oxm_pull_field_array(const void *fields_data, size_t fields_len,
             error = OFPERR_OFPBMC_DUP_FIELD;
         } else if (!mf_is_mask_valid(field, &value)) {
             VLOG_DBG_RL(&rl, "bad mask in field array field '%s'", field->name);
-            return OFPERR_OFPBMC_BAD_MASK;
+            error = OFPERR_OFPBMC_BAD_MASK;
         } else {
             field_array_set(field->id, &value, fa);
         }
@@ -762,6 +761,8 @@ oxm_pull_field_array(const void *fields_data, size_t fields_len,
             VLOG_DBG_RL(&rl, "error parsing OXM at offset %"PRIdPTR" "
                         "within field array (%s)", pos - start,
                         ofperr_to_string(error));
+
+            free(fa->values);
             return error;
         }
     }
-- 
2.16.1



More information about the dev mailing list