test_common: handle return value from make_byte_buffer()

master
Andre Puschmann 3 years ago
parent 8d2e81ad6f
commit a142192d4e

@ -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();
}

Loading…
Cancel
Save