]> granicus.if.org Git - taglib/commitdiff
Fixed possible memory leak
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 30 Apr 2013 16:32:48 +0000 (01:32 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Tue, 30 Apr 2013 16:32:48 +0000 (01:32 +0900)
taglib/riff/wav/infotag.cpp
taglib/riff/wav/infotag.h

index 5ce1df90722753a2548cbb459fdc353a20d91522..658ede886f1c31be0aec7afda959feca4beb8a4a 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
-    copyright            : (C) 2002 - 2008 by Scott Wheeler
+    copyright            : (C) 2012 by Tsuda Kageyu
     email                : wheeler@kde.org
  ***************************************************************************/
 
@@ -86,19 +86,22 @@ ByteVector RIFF::Info::StringHandler::render(const String &s) const
 static const StringHandler defaultStringHandler;
 const RIFF::Info::StringHandler *RIFF::Info::Tag::TagPrivate::stringHandler = &defaultStringHandler;
 
-RIFF::Info::Tag::Tag(const ByteVector &data) : TagLib::Tag()
+RIFF::Info::Tag::Tag(const ByteVector &data) 
+  : TagLib::Tag()
+  , d(new TagPrivate())
 {
-  d = new TagPrivate;
   parse(data);
 }
 
-RIFF::Info::Tag::Tag() : TagLib::Tag()
+RIFF::Info::Tag::Tag() 
+  : TagLib::Tag()
+  , d(new TagPrivate())
 {
-  d = new TagPrivate;
 }
 
 RIFF::Info::Tag::~Tag()
 {
+  delete d;
 }
 
 String RIFF::Info::Tag::title() const
index 3210b555277d22379983b4aed25edb8e85c10f73..9a26d4cb45ca08a361c1e0d751c6c89754e2c94f 100644 (file)
@@ -119,6 +119,7 @@ namespace TagLib {
       virtual void setTrack(uint i);
 
       virtual bool isEmpty() const;
+
       /*
        * Gets the value of the field with the ID \a id.
        */
@@ -129,7 +130,7 @@ namespace TagLib {
         * If the field does not exist, it is created.
         * If \s is empty, the field is removed.
         *
-        * \note fieldId must be four-byte long pure ascii string.  This function 
+        * \note fieldId must be four-byte long pure ASCII string.  This function 
         * performs nothing if fieldId is invalid.
         */
       void setFieldText(const ByteVector &id, const String &s);