Added guards in create object initialization to prevent memory leaks (#664)
This commit is contained in:
@@ -772,8 +772,7 @@ void Calendar_Cleanup(void)
|
||||
*/
|
||||
void Calendar_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (Object_List) {
|
||||
atexit(Calendar_Cleanup);
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1766,5 +1766,7 @@ void Channel_Cleanup(void)
|
||||
*/
|
||||
void Channel_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,5 +1216,7 @@ void Color_Cleanup(void)
|
||||
*/
|
||||
void Color_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1657,5 +1657,7 @@ void Color_Temperature_Cleanup(void)
|
||||
*/
|
||||
void Color_Temperature_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2462,5 +2462,7 @@ void Lighting_Output_Cleanup(void)
|
||||
*/
|
||||
void Lighting_Output_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -745,5 +745,7 @@ void Life_Safety_Point_Cleanup(void)
|
||||
*/
|
||||
void Life_Safety_Point_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -915,5 +915,7 @@ void Life_Safety_Zone_Cleanup(void)
|
||||
*/
|
||||
void Life_Safety_Zone_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -940,5 +940,7 @@ void Multistate_Input_Cleanup(void)
|
||||
*/
|
||||
void Multistate_Input_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1220,5 +1220,7 @@ void Multistate_Output_Cleanup(void)
|
||||
*/
|
||||
void Multistate_Output_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -939,5 +939,7 @@ void Multistate_Value_Cleanup(void)
|
||||
*/
|
||||
void Multistate_Value_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,8 +860,7 @@ void Structured_View_Cleanup(void)
|
||||
*/
|
||||
void Structured_View_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (Object_List) {
|
||||
atexit(Structured_View_Cleanup);
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,8 +809,7 @@ void Time_Value_Cleanup(void)
|
||||
*/
|
||||
void Time_Value_Init(void)
|
||||
{
|
||||
Object_List = Keylist_Create();
|
||||
if (Object_List) {
|
||||
atexit(Time_Value_Cleanup);
|
||||
if (!Object_List) {
|
||||
Object_List = Keylist_Create();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user