]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't close FD twice. CID #1433561
authorAlan T. DeKok <aland@freeradius.org>
Thu, 5 Apr 2018 12:34:41 +0000 (08:34 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 5 Apr 2018 12:34:41 +0000 (08:34 -0400)
src/modules/proto_detail/proto_detail_file.c

index c25383501d8792257c6c10b99fcd201f7b993176..e9f6ee211686f503e8bfcf83590282c7f05a0f86 100644 (file)
@@ -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;