Skip to content

Commit 540d423

Browse files
author
Max Aehle
committed
Fix memory leaks related to ActDisk
1 parent 58c4692 commit 540d423

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

Common/include/CConfig.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ class CConfig {
241241
*Marker_CHTInterface, /*!< \brief Conjugate heat transfer interface markers. */
242242
*Marker_ActDiskInlet, /*!< \brief Actuator disk inlet markers. */
243243
*Marker_ActDiskOutlet, /*!< \brief Actuator disk outlet markers. */
244-
*Marker_ActDiskBemInlet, /*!< \brief Actuator disk BEM inlet markers. */
245-
*Marker_ActDiskBemOutlet, /*!< \brief Actuator disk BEM outlet markers. */
244+
*Marker_ActDiskBemInlet=nullptr, /*!< \brief Actuator disk BEM inlet markers. */
245+
*Marker_ActDiskBemOutlet=nullptr, /*!< \brief Actuator disk BEM outlet markers. */
246246
*Marker_Inlet, /*!< \brief Inlet flow markers. */
247247
*Marker_Inlet_Species, /*!< \brief Inlet species markers. */
248248
*Marker_Inlet_Turb, /*!< \brief Inlet turbulent markers. */

Common/include/option_structure.inl

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,22 @@ class COptionActDisk : public COptionBase {
16961696
this->name = name;
16971697
}
16981698

1699-
~COptionActDisk() override{};
1699+
~COptionActDisk() override {
1700+
for (int i = 0; i < this->inlet_size; i++) {
1701+
delete[] this->press_jump[i];
1702+
delete[] this->temp_jump[i];
1703+
delete[] this->omega[i];
1704+
}
1705+
delete[] press_jump;
1706+
delete[] temp_jump;
1707+
delete[] omega;
1708+
1709+
delete[] marker_inlet;
1710+
delete[] marker_outlet;
1711+
1712+
SetDefault();
1713+
};
1714+
17001715
string SetValue(const vector<string>& option_value) override {
17011716
COptionBase::SetValue(option_value);
17021717
const int mod_num = 8;
@@ -1717,7 +1732,9 @@ class COptionActDisk : public COptionBase {
17171732
unsigned short nVals = totalVals / mod_num;
17181733
this->inlet_size = nVals;
17191734
this->outlet_size = nVals;
1735+
delete[] this->marker_inlet;
17201736
this->marker_inlet = new string[this->inlet_size];
1737+
delete[] this->marker_outlet;
17211738
this->marker_outlet = new string[this->outlet_size];
17221739

17231740
this->press_jump = new su2double*[this->inlet_size];

0 commit comments

Comments
 (0)