From: Alan T. DeKok Date: Thu, 5 Apr 2018 12:34:41 +0000 (-0400) Subject: don't close FD twice. CID #1433561 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=202b67d80b844196c5785de1a00a316766a51244;p=thirdparty%2Ffreeradius-server.git don't close FD twice. CID #1433561 --- diff --git a/src/modules/proto_detail/proto_detail_file.c b/src/modules/proto_detail/proto_detail_file.c index c25383501d8..e9f6ee21168 100644 --- a/src/modules/proto_detail/proto_detail_file.c +++ b/src/modules/proto_detail/proto_detail_file.c @@ -338,6 +338,7 @@ static int work_exists(proto_detail_file_t *inst, int fd) if (fr_event_filter_insert(inst, inst->el, fd, FR_EVENT_FILTER_VNODE, &funcs, NULL, inst) < 0) { PERROR("Failed adding work socket to event loop"); + close(fd); goto detach; } @@ -345,6 +346,7 @@ static int work_exists(proto_detail_file_t *inst, int fd) * Remember this for later. */ inst->vnode_fd = fd; + fd = -1; /* * Yuck. @@ -404,8 +406,6 @@ static int work_exists(proto_detail_file_t *inst, int fd) } detach: - close(fd); /* our FD for the work file */ - if (listen) (void) listen->app_io->detach(listen->app_io_instance); talloc_free(listen); return -1;