free structure on error.
authorAlan T. DeKok <aland@freeradius.org>
Mon, 1 Dec 2008 09:50:29 +0000 (10:50 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 1 Dec 2008 16:47:24 +0000 (17:47 +0100)
Closes Coverity #76

src/main/listen.c

index 1e07e4f..1e4926f 100644 (file)
@@ -1559,13 +1559,14 @@ int listen_init(CONF_SECTION *config, rad_listen_t **head)
                if (!sock->clients) {
                        cf_log_err(cf_sectiontoitem(config),
                                   "Failed to find any clients for this listen section");
+                       listen_free(&this);
                        return -1;
                }
 
                if (listen_bind(this) < 0) {
-                       listen_free(&this);
                        listen_free(head);
                        radlog(L_ERR, "There appears to be another RADIUS server running on the authentication port %d", sock->port);
+                       listen_free(&this);
                        return -1;
                }
                auth_port = sock->port; /* may have been updated in listen_bind */