From 5bffa4a17246a4974982ef05fcaeb1f493cfcd70 Mon Sep 17 00:00:00 2001 From: Matthias Zipp Date: Wed, 2 Mar 2022 11:39:02 +0100 Subject: [PATCH] fixed memory leak in setGoID, setGoCbRef and setDataSetRef --- src/goose/goose_publisher.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/goose/goose_publisher.c b/src/goose/goose_publisher.c index 97b536fa..3b42c435 100644 --- a/src/goose/goose_publisher.c +++ b/src/goose/goose_publisher.c @@ -115,18 +115,28 @@ GoosePublisher_destroy(GoosePublisher self) void GoosePublisher_setGoID(GoosePublisher self, char* goID) { + if (self->goID != NULL) + GLOBAL_FREEMEM(self->goID); + self->goID = StringUtils_copyString(goID); } void GoosePublisher_setGoCbRef(GoosePublisher self, char* goCbRef) { + if (self->goCBRef != NULL) + GLOBAL_FREEMEM(self->goCBRef); + self->goCBRef = StringUtils_copyString(goCbRef); } void GoosePublisher_setDataSetRef(GoosePublisher self, char* dataSetRef) { + + if (self->dataSetRef != NULL) + GLOBAL_FREEMEM(self->dataSetRef); + self->dataSetRef = StringUtils_copyString(dataSetRef); }