laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-uecups/+/33787 )
Change subject: gtp_daemon: Fix error paths in gtp_daemon_alloc()
......................................................................
gtp_daemon: Fix error paths in gtp_daemon_alloc()
Fixes: CID#307527: Unchecked return value (CHECKED_RETURN)
Change-Id: I690b24671567aac4dca24389309ebaa3e76e272c
---
M daemon/gtp_daemon.c
1 file changed, 23 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-uecups refs/changes/87/33787/1
diff --git a/daemon/gtp_daemon.c b/daemon/gtp_daemon.c
index b5b7ac8..31ae39f 100644
--- a/daemon/gtp_daemon.c
+++ b/daemon/gtp_daemon.c
@@ -54,6 +54,7 @@
struct gtp_daemon *gtp_daemon_alloc(void *ctx)
{
+ int rc;
struct gtp_daemon *d = talloc_zero(ctx, struct gtp_daemon);
if (!d)
return NULL;
@@ -66,7 +67,12 @@
d->main_thread = pthread_self();
d->itq = osmo_it_q_alloc(d, "itq", 4096, gtp_daemon_itq_read_cb, d);
- osmo_fd_register(&d->itq->event_ofd);
+ if (!d->itq)
+ goto out_free;
+
+ rc = osmo_fd_register(&d->itq->event_ofd);
+ if (rc < 0)
+ goto out_free_q;
INIT_LLIST_HEAD(&d->cups_clients);
@@ -74,4 +80,10 @@
d->cfg.cups_local_port = UECUPS_SCTP_PORT;
return d;
+
+out_free_q:
+ osmo_it_q_destroy(d->itq);
+out_free:
+ talloc_free(d);
+ return NULL;
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-uecups/+/33787
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-uecups
Gerrit-Branch: master
Gerrit-Change-Id: I690b24671567aac4dca24389309ebaa3e76e272c
Gerrit-Change-Number: 33787
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange