aboutsummaryrefslogtreecommitdiffstats
path: root/src/hnbgw.c
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-18 01:26:59 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-02-18 01:30:42 +0100
commit44beab9c3b318c5bf5d3cde9f14bf3f6d7334d6c (patch)
treec20d52cccc2045bf74f63c3ddd827ef7b377a0f0 /src/hnbgw.c
parent8cf9107670bfb91ae6b28720a42401af9e1944c8 (diff)
hnbgw: hnb_context_alloc(): fix missing free, missing return, wrong error return type
Also move INIT_LLIST_HEAD further up for good measure (cosmetic).
Diffstat (limited to 'src/hnbgw.c')
-rw-r--r--src/hnbgw.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 2f2ab8c..798789c 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -231,17 +231,18 @@ struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_
ctx = talloc_zero(tall_hnb_ctx, struct hnb_context);
if (!ctx)
return NULL;
+ INIT_LLIST_HEAD(&ctx->map_list);
ctx->gw = gw;
ctx->conn = osmo_stream_srv_create(tall_hnb_ctx, link, new_fd, hnb_read_cb, hnb_close_cb, ctx);
if (!ctx->conn) {
LOGP(DMAIN, LOGL_INFO, "error while creating connection\n");
- return -1;
+ talloc_free(ctx);
+ return NULL;
}
- INIT_LLIST_HEAD(&ctx->map_list);
-
llist_add_tail(&ctx->list, &gw->hnb_list);
+ return ctx;
}
void hnb_context_release(struct hnb_context *ctx)