diff options
author | Jack Lloyd <[email protected]> | 2017-09-22 19:35:28 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-22 19:35:28 -0400 |
commit | bac9f93cd68994710f2a2b916a0f121f715458b1 (patch) | |
tree | 9931fb629b17a2f5ca09cb49372fd51a0fa775f8 /src/lib | |
parent | ee45da7befa4b5dcc28105df13b6248029dbf036 (diff) |
LZMA - there is no reason for new or delete here
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/compression/lzma/lzma.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/compression/lzma/lzma.cpp b/src/lib/compression/lzma/lzma.cpp index 365affa91..92c61840a 100644 --- a/src/lib/compression/lzma/lzma.cpp +++ b/src/lib/compression/lzma/lzma.cpp @@ -22,17 +22,15 @@ class LZMA_Stream : public Zlib_Style_Stream<lzma_stream, uint8_t> public: LZMA_Stream() { - auto a = new ::lzma_allocator; - a->opaque = alloc(); - a->alloc = Compression_Alloc_Info::malloc<size_t>; - a->free = Compression_Alloc_Info::free; - streamp()->allocator = a; + m_allocator.opaque = alloc(); + m_allocator.alloc = Compression_Alloc_Info::malloc<size_t>; + m_allocator.free = Compression_Alloc_Info::free; + streamp()->allocator = &m_allocator; } ~LZMA_Stream() { ::lzma_end(streamp()); - delete streamp()->allocator; } bool run(uint32_t flags) override @@ -50,6 +48,8 @@ class LZMA_Stream : public Zlib_Style_Stream<lzma_stream, uint8_t> uint32_t run_flag() const override { return LZMA_RUN; } uint32_t flush_flag() const override { return LZMA_FULL_FLUSH; } uint32_t finish_flag() const override { return LZMA_FINISH; } + private: + ::lzma_allocator m_allocator; }; class LZMA_Compression_Stream final : public LZMA_Stream |