From 61534daa99a21e9b41ccd659cabeb9f2a5cc1293 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Sat, 18 Jun 2016 09:59:07 -0300 Subject: [PATCH] - fixed: client control object crashes when orIdent is set to NULL -> now sends empty octet string --- examples/iec61850_client_example3/client_example3.c | 2 ++ src/iec61850/client/client_control.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/iec61850_client_example3/client_example3.c b/examples/iec61850_client_example3/client_example3.c index 9c2e014..02cc78f 100644 --- a/examples/iec61850_client_example3/client_example3.c +++ b/examples/iec61850_client_example3/client_example3.c @@ -57,6 +57,8 @@ int main(int argc, char** argv) { MmsValue* ctlVal = MmsValue_newBoolean(true); + ControlObjectClient_setOrigin(control, NULL, 3); + if (ControlObjectClient_operate(control, ctlVal, 0 /* operate now */)) { printf("simpleIOGenericIO/GGIO1.SPCSO1 operated successfully\n"); } diff --git a/src/iec61850/client/client_control.c b/src/iec61850/client/client_control.c index d638c0a..54f4938 100644 --- a/src/iec61850/client/client_control.c +++ b/src/iec61850/client/client_control.c @@ -422,7 +422,11 @@ ControlObjectClient_setOrigin(ControlObjectClient self, const char* orIdent, int if (self->orIdent != NULL) GLOBAL_FREEMEM(self->orIdent); - self->orIdent = copyString(orIdent); + if (orIdent != NULL) + self->orIdent = copyString(orIdent); + else + self->orIdent = NULL; + self->orCat = orCat; }