From 929b8650a3740104416a2546c01efad4629da5e7 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Fri, 12 Feb 2021 19:11:30 +0000 Subject: [PATCH] handle byte buffer allocation error in s1ap --- srsenb/src/stack/upper/s1ap.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/srsenb/src/stack/upper/s1ap.cc b/srsenb/src/stack/upper/s1ap.cc index f3c2ece6c..e4aad3e0c 100644 --- a/srsenb/src/stack/upper/s1ap.cc +++ b/srsenb/src/stack/upper/s1ap.cc @@ -1744,7 +1744,11 @@ bool s1ap::ue::send_ho_required(uint32_t target_eci, // pack Transparent Container into HORequired message srslte::unique_byte_buffer_t buffer = srslte::make_byte_buffer(); - asn1::bit_ref bref(buffer->msg, buffer->get_tailroom()); + if (buffer == nullptr) { + logger.error("Failed to allocate buffer for HORequired message packing"); + return false; + } + asn1::bit_ref bref(buffer->msg, buffer->get_tailroom()); if (transparent_cntr.pack(bref) != asn1::SRSASN_SUCCESS) { logger.error("Failed to pack transparent container of HO Required message"); return false;