diff options
author | Alexander Couzens <lynxis@fe80.eu> | 2020-09-16 23:09:24 +0200 |
---|---|---|
committer | Alexander Couzens <lynxis@fe80.eu> | 2020-09-24 15:51:46 +0200 |
commit | 6a2c0740b1bc112c2c3a9292541c6fc6a36b91d7 (patch) | |
tree | a55c58584436361eeaafbba9d18ddac1ef16e1f2 /src/gb | |
parent | 349d3480a6e76615824532d9845520146f03c897 (diff) |
gb/gprs_bssgb: check if talloc failed on btsctx->fc
Change-Id: I1cfccc2cb696d9e95f590b99559d0a987031adfe
Diffstat (limited to 'src/gb')
-rw-r--r-- | src/gb/gprs_bssgp.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c index 9c119fbc..e5b4380f 100644 --- a/src/gb/gprs_bssgp.c +++ b/src/gb/gprs_bssgp.c @@ -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) |