From a142192d4e8f7d50c36c13234ed58db923a78c0a Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 14 Jul 2021 09:41:25 +0200 Subject: [PATCH] test_common: handle return value from make_byte_buffer() --- lib/include/srsran/common/test_common.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/include/srsran/common/test_common.h b/lib/include/srsran/common/test_common.h index 19d86f731..76180d184 100644 --- a/lib/include/srsran/common/test_common.h +++ b/lib/include/srsran/common/test_common.h @@ -145,6 +145,10 @@ inline void test_init(int argc, char** argv) inline void copy_msg_to_buffer(unique_byte_buffer_t& pdu, const_byte_span msg) { pdu = srsran::make_byte_buffer(); + if (pdu == nullptr) { + srslog::fetch_basic_logger("ALL").error("Couldn't allocate PDU in %s().", __FUNCTION__); + return; + } memcpy(pdu->msg, msg.data(), msg.size()); pdu->N_bytes = msg.size(); }