trxcon: fix NULL pointer dereference in trx_if_open()

Change-Id: Id40e758f6736773f7695c02bdb8974ee422b2e63
Related: CID#275253
This commit is contained in:
Vadim Yanitskiy 2022-07-22 17:03:46 +07:00
parent 78e5668d52
commit 28b5934663
1 changed files with 2 additions and 2 deletions

View File

@ -704,14 +704,14 @@ struct trx_instance *trx_if_open(struct trxcon_inst *trxcon,
/* Try to allocate memory */
trx = talloc_zero(trxcon, struct trx_instance);
if (!trx) {
LOGPFSML(trx->fi, LOGL_ERROR, "Failed to allocate memory\n");
LOGPFSML(trxcon->fi, LOGL_ERROR, "Failed to allocate memory\n");
return NULL;
}
/* Allocate a new dedicated state machine */
trx->fi = osmo_fsm_inst_alloc_child(&trx_fsm, trxcon->fi, TRX_EVENT_OFFLINE);
if (trx->fi == NULL) {
LOGPFSML(trx->fi, LOGL_ERROR, "Failed to allocate an instance "
LOGPFSML(trxcon->fi, LOGL_ERROR, "Failed to allocate an instance "
"of FSM '%s'\n", trx_fsm.name);
talloc_free(trx);
return NULL;