]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
free the worker if we're closing the FD
authorAlan T. DeKok <aland@freeradius.org>
Tue, 17 Oct 2017 19:57:52 +0000 (15:57 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 17 Oct 2017 19:58:33 +0000 (15:58 -0400)
and if the flag tells us to

src/modules/proto_detail/proto_detail.h
src/modules/proto_detail/proto_detail_work.c

index 7514a0cbd3686e9fbd27180796876df8464366fd..b7c76cc224c96173f1ae6157753a5ce7e57abca0 100644 (file)
@@ -85,6 +85,7 @@ typedef struct proto_detail_work_t {
        bool                            closing;                //!< we should be closing the file
 
        bool                            track_progress;         //!< do we track progress by writing?
+       bool                            free_on_close;          //!< free the worker on close
 
        int                             mode;                   //!< O_RDWR or O_RDONLY
 
index 47674a20b5300b0741eda80828734edf4d05373c..3d2a10329525f5a340faf408d7ac6721c3b6a841 100644 (file)
@@ -503,6 +503,11 @@ static int mod_close(void *instance)
        close(inst->fd);
        inst->fd = -1;
 
+       if (inst->free_on_close) {
+               inst->parent->work_io_instance = NULL;
+               talloc_free(inst);
+       }
+
        return 0;
 }