Fix test-i2c leak, and mctp_pktbuf storage alignment

- Ensure mctp_pktbuf storage is correctly aligned
- Deallocate mctp and i2c instances to avoid failure with asan.

These previously succeeded in CI so are both fixed in this commit.

Fixes: e5b941d9d764 ("i2c: Add binding for MCTP over I2C transport")
Fixes: 4a09e1dc4883 ("core: Reuse buffers for tx, allow message pools")
Change-Id: I747bfff6faf3a5b0a982ae266bcef02ecbc4ee8a
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/libmctp.h b/libmctp.h
index 2fdd812..96ee975 100644
--- a/libmctp.h
+++ b/libmctp.h
@@ -11,6 +11,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stddef.h>
+#include <stdalign.h>
 
 typedef uint8_t mctp_eid_t;
 
@@ -58,6 +59,7 @@
 
 #define MCTP_PKTBUF_SIZE(payload)                                              \
 	(MCTP_PACKET_SIZE(payload) + sizeof(struct mctp_pktbuf))
+#define PKTBUF_STORAGE_ALIGN __attribute((aligned(alignof(struct mctp_pktbuf))))
 
 struct mctp;
 struct mctp_bus;
@@ -65,7 +67,9 @@
 
 /* Initialise a mctp_pktbuf in static storage. Should not be freed.
  * Storage must be sized to fit the binding,
- * MCTP_PKTBUF_SIZE(binding->pkt_size + binding->pkt_header + binding->pkt_trailer) */
+ * MCTP_PKTBUF_SIZE(binding->pkt_size + binding->pkt_header + binding->pkt_trailer).
+ * storage must be aligned to alignof(struct mctp_pktbuf), 
+ * use PKTBUF_STORAGE_ALIGN macro */
 struct mctp_pktbuf *mctp_pktbuf_init(struct mctp_binding *binding,
 				     void *storage);
 /* Allocate and initialise a mctp_pktbuf. Should be freed with
@@ -175,7 +179,7 @@
 /**
  * @tx: Binding function to transmit one packet on the interface
  * @tx_storage: A buffer for transmitting packets. Must be sized
- * as MCTP_PKTBUF_SIZE(mtu).
+ * as MCTP_PKTBUF_SIZE(mtu) and 8 byte aligned.
  *      Return:
  *      * 0 - Success, pktbuf can be released
  *	* -EMSGSIZE - Packet exceeds binding MTU, pktbuf must be dropped