summaryrefslogtreecommitdiff
path: root/usr.sbin/nsd/remote.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/nsd/remote.c')
-rw-r--r--usr.sbin/nsd/remote.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/nsd/remote.c b/usr.sbin/nsd/remote.c
index 759136c9645..82b49990216 100644
--- a/usr.sbin/nsd/remote.c
+++ b/usr.sbin/nsd/remote.c
@@ -567,10 +567,16 @@ remote_accept_callback(int fd, short event, void* arg)
event_set(&n->c, newfd, EV_PERSIST|EV_TIMEOUT|EV_READ,
remote_control_callback, n);
- if(event_base_set(xfrd->event_base, &n->c) != 0)
+ if(event_base_set(xfrd->event_base, &n->c) != 0) {
log_msg(LOG_ERR, "remote_accept: cannot set event_base");
- if(event_add(&n->c, &n->tval) != 0)
+ free(n);
+ goto close_exit;
+ }
+ if(event_add(&n->c, &n->tval) != 0) {
log_msg(LOG_ERR, "remote_accept: cannot add event");
+ free(n);
+ goto close_exit;
+ }
n->event_added = 1;
if(2 <= verbosity) {