From: Alan T. DeKok Date: Tue, 17 Oct 2017 19:57:52 +0000 (-0400) Subject: free the worker if we're closing the FD X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8c76b2ff0fabd431a56567049aebe2a72d8981d;p=thirdparty%2Ffreeradius-server.git free the worker if we're closing the FD and if the flag tells us to --- diff --git a/src/modules/proto_detail/proto_detail.h b/src/modules/proto_detail/proto_detail.h index 7514a0cbd36..b7c76cc224c 100644 --- a/src/modules/proto_detail/proto_detail.h +++ b/src/modules/proto_detail/proto_detail.h @@ -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 diff --git a/src/modules/proto_detail/proto_detail_work.c b/src/modules/proto_detail/proto_detail_work.c index 47674a20b53..3d2a1032952 100644 --- a/src/modules/proto_detail/proto_detail_work.c +++ b/src/modules/proto_detail/proto_detail_work.c @@ -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; }