gtp_daemon: Fix error paths in gtp_daemon_alloc()

Fixes: CID#307527: Unchecked return value (CHECKED_RETURN)
Change-Id: I690b24671567aac4dca24389309ebaa3e76e272c
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;
 }