susumu.yata
null+****@clear*****
Mon Dec 15 18:53:14 JST 2014
susumu.yata 2014-12-15 18:53:14 +0900 (Mon, 15 Dec 2014) New Revision: 6cc922f048127069f18de24609af12d06d8e4618 https://github.com/groonga/grnxx/commit/6cc922f048127069f18de24609af12d06d8e4618 Message: Fix memory leak. (#129) Modified files: include/grnxx/array.hpp Modified: include/grnxx/array.hpp (+6 -0) =================================================================== --- include/grnxx/array.hpp 2014-12-15 16:48:50 +0900 (5c2e01a) +++ include/grnxx/array.hpp 2014-12-15 18:53:14 +0900 (37ee8e1) @@ -150,6 +150,9 @@ class Array<T, false> { Array() : buffer_(nullptr), size_(0), capacity_(0) {} ~Array() { + for (size_t i = 0; i < size_; ++i) { + buffer()[i].~Value(); + } std::free(buffer_); } @@ -167,6 +170,9 @@ class Array<T, false> { } // Move the ownership of an array. Array &operator=(Array &&array) & { + for (size_t i = 0; i < size_; ++i) { + buffer()[i].~Value(); + } std::free(buffer_); buffer_ = array.buffer_; size_ = array.size_; -------------- next part -------------- HTML����������������������������...Download