cleanup for dbRegisterFilter()
This commit is contained in:
@@ -523,11 +523,20 @@ static void channel_close(chFilter *filter)
|
||||
free(f); /* FIXME: Use a free-list */
|
||||
}
|
||||
|
||||
static void plugin_free(void* puser)
|
||||
{
|
||||
chfPlugin *p=puser;
|
||||
free(p->required);
|
||||
free(p);
|
||||
}
|
||||
|
||||
/*
|
||||
* chFilterIf for the wrapper
|
||||
* we just support a simple one-level map, and no arrays
|
||||
*/
|
||||
static chFilterIf wrapper_fif = {
|
||||
plugin_free,
|
||||
|
||||
parse_start,
|
||||
parse_abort,
|
||||
parse_end,
|
||||
|
||||
@@ -72,6 +72,10 @@ typedef enum {
|
||||
|
||||
/* These routines must be implemented by each filter plug-in */
|
||||
typedef struct chFilterIf {
|
||||
/* cleanup pointer passed to dbRegisterFilter().
|
||||
* Called during DB shutdown
|
||||
*/
|
||||
void (* priv_free)(void *puser);
|
||||
/* Parsing event handlers: */
|
||||
parse_result (* parse_start)(chFilter *filter);
|
||||
/* If parse_start() returns parse_continue for a filter, one of
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "epicsStdlib.h"
|
||||
#include "epicsString.h"
|
||||
#include "epicsStdio.h"
|
||||
#include "dbChannel.h"
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "link.h"
|
||||
@@ -592,6 +593,8 @@ void epicsShareAPI dbFreeBase(dbBase *pdbbase)
|
||||
drvSup *pdrvSupNext;
|
||||
brkTable *pbrkTable;
|
||||
brkTable *pbrkTableNext;
|
||||
chFilterPlugin *pfilt;
|
||||
chFilterPlugin *pfiltNext;
|
||||
int i;
|
||||
DBENTRY dbentry;
|
||||
|
||||
@@ -723,6 +726,15 @@ void epicsShareAPI dbFreeBase(dbBase *pdbbase)
|
||||
free((void *)pbrkTable);
|
||||
pbrkTable = pbrkTableNext;
|
||||
}
|
||||
pfilt = (chFilterPlugin *)ellFirst(&pdbbase->filterList);
|
||||
while(pfilt) {
|
||||
pfiltNext = (chFilterPlugin *)ellNext(&pfilt->node);
|
||||
free((char*)pfilt->name);
|
||||
if(pfilt->fif->priv_free)
|
||||
(*pfilt->fif->priv_free)(pfilt->puser);
|
||||
free(pfilt);
|
||||
pfilt = pfiltNext;
|
||||
}
|
||||
gphFreeMem(pdbbase->pgpHash);
|
||||
dbPvdFreeMem(pdbbase);
|
||||
dbFreePath(pdbbase);
|
||||
|
||||
Reference in New Issue
Block a user