diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-02-28 13:53:34 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-02-28 08:12:26 -0800 |
commit | ee1c438d4161ab6009781ff358bec922d5e811c2 (patch) | |
tree | a2a7455a1b3e56fac242579a6e84458071e16eb2 /qt-models | |
parent | f55c15e5f957d8ab1c7a5573c173f45ba382cf0b (diff) | |
download | subsurface-ee1c438d4161ab6009781ff358bec922d5e811c2.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/cylindermodel.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
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; } |