LAPD: Add function to release/free a LAPD instance
diff --git a/include/osmocom/abis/lapd.h b/include/osmocom/abis/lapd.h
index dd22028..92dc2c3 100644
--- a/include/osmocom/abis/lapd.h
+++ b/include/osmocom/abis/lapd.h
@@ -48,6 +48,7 @@
 					  void (*tx_cb)(uint8_t *data, int len,
 							void *cbdata), void *cbdata);
 
+void lapd_instance_free(struct lapd_instance *li);
 
 /* Start a (user-side) SAP for the specified TEI/SAPI on the LAPD instance */
 int lapd_sap_start(struct lapd_instance *li, uint8_t tei, uint8_t sapi);
diff --git a/src/input/lapd.c b/src/input/lapd.c
index 0287e14..d94af58 100644
--- a/src/input/lapd.c
+++ b/src/input/lapd.c
@@ -730,3 +730,10 @@
 
 	return li;
 }
+
+void lapd_instance_free(struct lapd_instance *li)
+{
+	/* tei and sapis are allocated hierarchically of the lapd
+	 * instance, so one free is sufficient here */
+	talloc_free(li);
+}