[PATCH 12/17] Free descriptions copied for TankItem

Anton Lundin glance at acc.umu.se
Wed Dec 17 23:47:53 PST 2014


Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 qt-ui/profile/tankitem.cpp | 7 +++++++
 qt-ui/profile/tankitem.h   | 1 +
 2 files changed, 8 insertions(+)

diff --git a/qt-ui/profile/tankitem.cpp b/qt-ui/profile/tankitem.cpp
index 42692aa..6193680 100644
--- a/qt-ui/profile/tankitem.cpp
+++ b/qt-ui/profile/tankitem.cpp
@@ -33,6 +33,13 @@ TankItem::TankItem(QObject *parent) :
 	memset(&diveCylinderStore, 0, sizeof(diveCylinderStore));
 }
 
+TankItem::~TankItem()
+{
+	// Should this be clear_dive(diveCylinderStore)?
+	for (int i = 0; i < MAX_CYLINDERS; i++)
+		free((void *)diveCylinderStore.cylinder[i].type.description);
+}
+
 void TankItem::setData(DivePlotDataModel *model, struct plot_info *plotInfo, struct dive *d)
 {
 	free(pInfoEntry);
diff --git a/qt-ui/profile/tankitem.h b/qt-ui/profile/tankitem.h
index f8d4ac9..d5c4b7f 100644
--- a/qt-ui/profile/tankitem.h
+++ b/qt-ui/profile/tankitem.h
@@ -15,6 +15,7 @@ class TankItem : public QObject, public QGraphicsRectItem
 
 public:
 	explicit TankItem(QObject *parent = 0);
+	~TankItem();
 	void setHorizontalAxis(DiveCartesianAxis *horizontal);
 	void setData(DivePlotDataModel *model, struct plot_info *plotInfo, struct dive *d);
 
-- 
2.1.0



More information about the subsurface mailing list