diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-05-17 19:32:45 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-05-17 19:32:45 +0200 |
commit | 705f86b3d71160c90920bc665a9bbb2b8daf392c (patch) | |
tree | 02335e6edc0dc280689216b80fc61a5f62e30ae0 /src/exiv2wrapper.cpp | |
parent | 65e13aae83c40b5e040b59ac40415b4f97d24bb1 (diff) | |
download | pyexiv2-705f86b3d71160c90920bc665a9bbb2b8daf392c.tar.gz |
Free the allocated memory when deleting an IptcTag.
Diffstat (limited to 'src/exiv2wrapper.cpp')
-rw-r--r-- | src/exiv2wrapper.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp index de53b94..3cdc2d5 100644 --- a/src/exiv2wrapper.cpp +++ b/src/exiv2wrapper.cpp @@ -633,7 +633,9 @@ const std::string ExifTag::getHumanValue() IptcTag::IptcTag(const std::string& key, Exiv2::IptcMetadata* data): _key(key) { - if (data != 0) + _from_data = (data != 0); + + if (_from_data) { _data = data; } @@ -664,6 +666,14 @@ IptcTag::IptcTag(const std::string& key, Exiv2::IptcMetadata* data): _key(key) } } +IptcTag::~IptcTag() +{ + if (!_from_data) + { + delete _data; + } +} + void IptcTag::setRawValues(const boost::python::list& values) { if (!_repeatable && (boost::python::len(values) > 1)) |