[Skiboot] [PATCH] hiomap: free ipmi message in callback

Stewart Smith stewart at linux.ibm.com
Fri Oct 26 15:54:12 AEDT 2018


Otherwise we'd slowly leak memory on each hiomap operation.

Fixes: 529bdca0bc546a7ae3ecbd2c3134b7260072d8b0
Tested-by: Andrew Jeffery <andrew at aj.id.au>
Signed-off-by: Stewart Smith <stewart at linux.ibm.com>
---
 libflash/ipmi-hiomap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libflash/ipmi-hiomap.c b/libflash/ipmi-hiomap.c
index d36c5f12edde..5300daefa9d2 100644
--- a/libflash/ipmi-hiomap.c
+++ b/libflash/ipmi-hiomap.c
@@ -117,6 +117,7 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
 	if (msg->resp_size < 2) {
 		prerror("Illegal response size: %u\n", msg->resp_size);
 		res->cc = IPMI_ERR_UNSPECIFIED;
+		ipmi_free_msg(msg);
 		return;
 	}
 
@@ -124,6 +125,7 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
 		prerror("Unmatched sequence number: wanted %u got %u\n",
 			ctx->seq, msg->data[1]);
 		res->cc = IPMI_ERR_UNSPECIFIED;
+		ipmi_free_msg(msg);
 		return;
 	}
 
@@ -210,6 +212,7 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg)
 		      msg->data[0]);
 		break;
 	};
+	ipmi_free_msg(msg);
 }
 
 static bool hiomap_get_info(struct ipmi_hiomap *ctx)
-- 
2.17.2



More information about the Skiboot mailing list