mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
f55c15e5f9
commit
ee1c438d41
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue