diff --git a/src/ioc/db/dbUnitTest.c b/src/ioc/db/dbUnitTest.c index 6926595c2..c259e1234 100644 --- a/src/ioc/db/dbUnitTest.c +++ b/src/ioc/db/dbUnitTest.c @@ -36,6 +36,7 @@ static ELLLIST testEvtList; /* holds testMonitor::node */ struct testMonitor { ELLNODE node; dbEventSubscription sub; + dbChannel *chan; epicsEventId event; unsigned count; }; @@ -322,7 +323,7 @@ testMonitor* testMonitorCreate(const char* pvname, unsigned mask, unsigned opt) mon->event = epicsEventMustCreate(epicsEventEmpty); - chan = dbChannelCreate(pvname); + chan = mon->chan = dbChannelCreate(pvname); if(!chan) testAbort("testMonitorCreate - dbChannelCreate(\"%s\") fails", pvname); if(!!(status=dbChannelOpen(chan))) @@ -353,6 +354,8 @@ void testMonitorDestroy(testMonitor *mon) db_cancel_event(mon->sub); + dbChannelDelete(mon->chan); + epicsEventDestroy(mon->event); free(mon);