From d6fc2ef4aac0c921633b353e3a1a7e0d636b6e83 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Wed, 1 May 2013 01:32:48 +0900 Subject: [PATCH] Fixed possible memory leak --- taglib/riff/wav/infotag.cpp | 13 ++++++++----- taglib/riff/wav/infotag.h | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/taglib/riff/wav/infotag.cpp b/taglib/riff/wav/infotag.cpp index 5ce1df90..658ede88 100644 --- a/taglib/riff/wav/infotag.cpp +++ b/taglib/riff/wav/infotag.cpp @@ -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 diff --git a/taglib/riff/wav/infotag.h b/taglib/riff/wav/infotag.h index 3210b555..9a26d4cb 100644 --- a/taglib/riff/wav/infotag.h +++ b/taglib/riff/wav/infotag.h @@ -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);