gb/gprs_bssgb: check if talloc failed on btsctx->fc

Change-Id: I1cfccc2cb696d9e95f590b99559d0a987031adfe
This commit is contained in:
Alexander Couzens 2020-09-16 23:09:24 +02:00
parent 349d3480a6
commit 6a2c0740b1
1 changed files with 12 additions and 4 deletions

View File

@ -146,17 +146,25 @@ struct bssgp_bvc_ctx *btsctx_alloc(uint16_t bvci, uint16_t nsei)
ctx->nsei = nsei;
/* FIXME: BVCI is not unique, only BVCI+NSEI ?!? */
ctx->ctrg = rate_ctr_group_alloc(ctx, &bssgp_ctrg_desc, bvci);
if (!ctx->ctrg) {
talloc_free(ctx);
return NULL;
}
if (!ctx->ctrg)
goto err_ctrg;
ctx->fc = talloc_zero(ctx, struct bssgp_flow_control);
if (!ctx->fc)
goto err_fc;
/* cofigure for 2Mbit, 30 packets in queue */
bssgp_fc_init(ctx->fc, 100000, 2*1024*1024/8, 30, &_bssgp_tx_dl_ud);
llist_add(&ctx->list, &bssgp_bvc_ctxts);
return ctx;
err_fc:
rate_ctr_group_free(ctx->ctrg);
err_ctrg:
talloc_free(ctx);
return NULL;
}
void bssgp_bvc_ctx_free(struct bssgp_bvc_ctx *ctx)