From 88737f02edbacdf99bd9562bf5c01d60b0c25d07 Mon Sep 17 00:00:00 2001 From: Eelco Chaudron Date: Thu, 5 Jun 2025 16:51:26 +0200 Subject: [PATCH] ofproto-dpif-xlate: Fix memory leak in xlate_generic_encap_action(). This is not a real issue, as the initializer function, rewrite_flow_push_nsh(), ensures it returns NULL on error. However, cleaning this up improves code clarity and resolves a Coverity warning about a potential memory leak. Acked-by: Aaron Conole Signed-off-by: Eelco Chaudron --- ofproto/ofproto-dpif-xlate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index c8c3b1210..2c8197fb7 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -7055,6 +7055,8 @@ xlate_generic_encap_action(struct xlate_ctx *ctx, /* The actual encap datapath action will be generated at next commit. */ ctx->pending_encap = true; ctx->encap_data = encap_data; + } else { + ofpbuf_delete(encap_data); } }