Skip to content

Commit 012c216

Browse files
authored
Fix: Fix memory leak introduced by new gint module (#6375)
* fix memory leak * delete copy assignment
1 parent 7c68dfc commit 012c216

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

source/source_lcao/module_hcontainer/hcontainer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ HContainer<T>::HContainer(HContainer<T>&& HR_in) noexcept
4646
this->wrapper_pointer = HR_in.wrapper_pointer;
4747
this->gamma_only = HR_in.gamma_only;
4848
this->paraV = HR_in.paraV;
49+
this->allocated = HR_in.allocated;
4950
this->current_R = -1;
5051
HR_in.wrapper_pointer = nullptr;
5152
// tmp terms not moved
@@ -63,6 +64,7 @@ HContainer<T>& HContainer<T>::operator=(HContainer<T>&& HR_in) noexcept
6364
this->wrapper_pointer = HR_in.wrapper_pointer;
6465
this->gamma_only = HR_in.gamma_only;
6566
this->paraV = HR_in.paraV;
67+
this->allocated = HR_in.allocated;
6668
this->current_R = -1;
6769

6870
HR_in.wrapper_pointer = nullptr;

source/source_lcao/module_hcontainer/hcontainer.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ class HContainer
154154
* data of HR_in will not be copied, please call add() after this constructor to copy data.
155155
*/
156156
HContainer(const HContainer<T>& HR_in, T* data_array = nullptr);
157-
157+
158+
// copy assignment, not allowed
159+
HContainer& operator=(const HContainer<T>& HR_in) = delete;
160+
158161
// move constructor
159162
HContainer(HContainer<T>&& HR_in) noexcept;
160163
// move assignment

0 commit comments

Comments
 (0)