diff options
author | monkeyman_67156 <monkeyman_67156@svn> | 2009-10-17 16:24:50 +0000 |
---|---|---|
committer | monkeyman_67156 <monkeyman_67156@svn> | 2009-10-17 16:24:50 +0000 |
commit | 39da4a1bbd0ef947d4cacdd6d94176add55f1461 (patch) | |
tree | ecfdba9da1aa93b75485f485f2979d9fcb440b4b | |
parent | 9b289c1b25f6119f757b31e85142df5c75ae958e (diff) |
fixed: memleak in texture writer, pass string by reference.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23797 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | tools/TexturePacker/XBTFWriter.cpp | 5 | ||||
-rw-r--r-- | tools/TexturePacker/XBTFWriter.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/tools/TexturePacker/XBTFWriter.cpp b/tools/TexturePacker/XBTFWriter.cpp index ed9d784cb8..6812d8af38 100644 --- a/tools/TexturePacker/XBTFWriter.cpp +++ b/tools/TexturePacker/XBTFWriter.cpp @@ -10,10 +10,10 @@ #define WRITE_U32(i, file) { uint32_t _n = Endian_SwapLE32(i); fwrite(&_n, 4, 1, file); } #define WRITE_U64(i, file) { uint64_t _n = i; _n = Endian_SwapLE64(i); fwrite(&_n, 8, 1, file); } -CXBTFWriter::CXBTFWriter(CXBTF& xbtf, const std::string outputFile) : m_xbtf(xbtf) +CXBTFWriter::CXBTFWriter(CXBTF& xbtf, const std::string& outputFile) : m_xbtf(xbtf) { m_outputFile = outputFile; - m_file = NULL; + m_file = m_tempFile = NULL; } bool CXBTFWriter::Create() @@ -53,6 +53,7 @@ bool CXBTFWriter::Close() { fwrite(tmp, bytesRead, 1, m_file); } + delete[] tmp; fclose(m_file); fclose(m_tempFile); diff --git a/tools/TexturePacker/XBTFWriter.h b/tools/TexturePacker/XBTFWriter.h index 806c468ee6..89ac46d3bf 100644 --- a/tools/TexturePacker/XBTFWriter.h +++ b/tools/TexturePacker/XBTFWriter.h @@ -8,7 +8,7 @@ class CXBTFWriter { public: - CXBTFWriter(CXBTF& xbtf, const std::string outputFile); + CXBTFWriter(CXBTF& xbtf, const std::string& outputFile); bool Create(); bool Close(); bool AppendContent(unsigned char const* data, size_t length); |