serial: Add mctp_serial_destroy()
Provide an abstraction to clean up memory to avoid false-positives from
leak sanitizers.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I3b8b044c81cb5ba99fb91261d5bf952993497dd7
diff --git a/libmctp-serial.h b/libmctp-serial.h
index 3e6fc5f..8a70101 100644
--- a/libmctp-serial.h
+++ b/libmctp-serial.h
@@ -12,6 +12,7 @@
struct mctp_binding_serial;
struct mctp_binding_serial *mctp_serial_init(void);
+void mctp_serial_destroy(struct mctp_binding_serial *serial);
struct mctp_binding *mctp_binding_serial_core(struct mctp_binding_serial *b);
diff --git a/serial.c b/serial.c
index c90de54..f24148a 100644
--- a/serial.c
+++ b/serial.c
@@ -356,3 +356,7 @@
return serial;
}
+void mctp_serial_destroy(struct mctp_binding_serial *serial)
+{
+ __mctp_free(serial);
+}