From 7c0dfe437af42eefe133514fb4f04c1a31231b30 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 1 Jul 2013 17:06:49 +1000 Subject: [PATCH] SICS-632 Allocate a copy of the connection, for motor tracing, and free it at the end. --- site_ansto/motor_dmc2280.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index 6328ba9c..a3c183df 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -4374,11 +4374,14 @@ int DMC2280Action(SConnection *pCon, SicsInterp *pSics, void *pData, } else if(strcasecmp("trace", argv[1]) == 0) { if (argc > 2 && strcasecmp("on", argv[2]) == 0) { - self->trace = pCon; + self->trace = SCCopyConnection(pCon); SCWrite(pCon, "TRACE ON", eValue); } else { - self->trace = 0; + if (self->trace) { + SCDeleteConnection(self->trace); + self->trace = 0; + } SCWrite(pCon, "TRACE OFF", eValue); } return 1;