aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2010-05-17 19:15:42 +0200
committerOlivier Tilloy <olivier@tilloy.net>2010-05-17 19:15:42 +0200
commit65e13aae83c40b5e040b59ac40415b4f97d24bb1 (patch)
tree39f44d4ce491323a0df00ce47c6da296e16e75ba
parent7f9cecbb6211c5712220ca6a9fc33eadbf6e7e8c (diff)
downloadpyexiv2-65e13aae83c40b5e040b59ac40415b4f97d24bb1.tar.gz
Free the allocated memory when deleting an ExifTag.
-rw-r--r--src/exiv2wrapper.cpp8
-rw-r--r--src/exiv2wrapper.hpp2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp
index 4412966..de53b94 100644
--- a/src/exiv2wrapper.cpp
+++ b/src/exiv2wrapper.cpp
@@ -572,6 +572,14 @@ ExifTag::ExifTag(const std::string& key, Exiv2::Exifdatum* datum, Exiv2::ExifDat
_sectionDescription = Exiv2::ExifTags::sectionDesc(tag, ifd);
}
+ExifTag::~ExifTag()
+{
+ if (_data == 0)
+ {
+ delete _datum;
+ }
+}
+
void ExifTag::setRawValue(const std::string& value)
{
_datum->setValue(value);
diff --git a/src/exiv2wrapper.hpp b/src/exiv2wrapper.hpp
index 2be1855..29c266b 100644
--- a/src/exiv2wrapper.hpp
+++ b/src/exiv2wrapper.hpp
@@ -42,6 +42,8 @@ public:
// Constructor
ExifTag(const std::string& key, Exiv2::Exifdatum* datum=0, Exiv2::ExifData* data=0);
+ ~ExifTag();
+
void setRawValue(const std::string& value);
const std::string getKey();