From ee1c438d4161ab6009781ff358bec922d5e811c2 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 28 Feb 2020 13:53:34 +0100 Subject: cleanup: fix leak in CylindersModel::setData() The C-string cyl->type.description was set without the old data being freed. Free the old string before overwriting the pointer. Signed-off-by: Berthold Stoeger --- qt-models/cylindermodel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'qt-models') diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index 201676bde..554d81cc7 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -322,6 +322,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in QByteArray ba = value.toByteArray(); const char *text = ba.constData(); if (!cyl->type.description || strcmp(cyl->type.description, text)) { + free((void *)cyl->type.description); cyl->type.description = strdup(text); changed = true; } -- cgit v1.2.3-70-g09d2