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>
This commit is contained in:
Anton Lundin 2014-12-18 08:47:43 +01:00 committed by Dirk Hohndel
parent da154222cc
commit d812d7b1f6

View file

@ -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: