summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-12-18 08:47:43 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-18 07:20:25 -0800
commitd812d7b1f6c639e562f13bf5ee202655cd96cc98 (patch)
treed869e8d998a6150b809f1444db6f99c5407ce201 /qt-ui/models.cpp
parentda154222cc659769770a625c17bf4162eb929f42 (diff)
downloadsubsurface-d812d7b1f6c639e562f13bf5ee202655cd96cc98.tar.gz
Free memory returned from get_dive_gas_string
After we created a QString from it, we need to free the char*. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 2bb40ef59..0778b7bca 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -1217,9 +1217,6 @@ QVariant DiveItem::data(int column, int role) const
case CYLINDER:
retVal = QString(dive->cylinder[0].type.description);
break;
- case GAS:
- retVal = QString(get_dive_gas_string(dive));
- break;
case SAC:
retVal = displaySac();
break;
@@ -1232,6 +1229,11 @@ QVariant DiveItem::data(int column, int role) const
case LOCATION:
retVal = QString(dive->location);
break;
+ case GAS:
+ const char *gas_string = get_dive_gas_string(dive);
+ retVal = QString(gas_string);
+ free((void*)gas_string);
+ break;
}
break;
case Qt::ToolTipRole: