From d812d7b1f6c639e562f13bf5ee202655cd96cc98 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Thu, 18 Dec 2014 08:47:43 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/models.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'qt-ui/models.cpp') 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: -- cgit v1.2.3-70-g09d2