Bluetooth: L2CAP: don't use NULL buf

Allocation of `buf` can fail. It just very rarely happens in practice.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c
index c266c55..ec272bc 100644
--- a/subsys/bluetooth/host/l2cap.c
+++ b/subsys/bluetooth/host/l2cap.c
@@ -521,6 +521,10 @@
 				      sizeof(*req) +
 				      (channels * sizeof(uint16_t)));
 
+	if (!buf) {
+		return -ENOMEM;
+	}
+
 	req = net_buf_add(buf, sizeof(*req));
 
 	ch = BT_L2CAP_LE_CHAN(chan[0]);
@@ -1407,6 +1411,9 @@
 response:
 	buf = l2cap_create_le_sig_pdu(BT_L2CAP_ECRED_RECONF_RSP, ident,
 				      sizeof(*rsp));
+	if (!buf) {
+		return;
+	}
 
 	rsp = net_buf_add(buf, sizeof(*rsp));
 	rsp->result = sys_cpu_to_le16(result);