]> rtime.felk.cvut.cz Git - frescor/forb.git/commitdiff
Added error handling to unix proto initialization
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 12 Jan 2009 13:59:22 +0000 (14:59 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 12 Jan 2009 13:59:22 +0000 (14:59 +0100)
src/forb.c

index 33584988e0a5f8fb2220309eeafa5185c67747b0..1c33d95a2665aa05c57e6e412f3957396d3c4b02 100644 (file)
@@ -209,9 +209,16 @@ forb_init(int *argc, char **argv[], const char *orb_id)
                forb_port_t *port = forb_malloc(sizeof(*port));
                if (port) {
                        memset(port, 0, sizeof(*port));
-                       forb_unix_port_init(&port->desc, &forb->server_id);
-                       forb_register_port(forb, port);
+                       ret = forb_unix_port_init(&port->desc, &forb->server_id);
+                       if (ret) goto err_free_unix;
+                       ret = forb_register_port(forb, port);
+                       if (ret) goto err_free_unix; /* TODO: forb_unix_port_done() */
+                       goto unix_ok;
                }
+       err_free_unix:
+               free(port);
+               goto err2;
+       unix_ok:;
        }
 #endif
        return orb;