aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpwdgrp/pwd_grp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c
index 6d938f621..539d2b01f 100644
--- a/libpwdgrp/pwd_grp.c
+++ b/libpwdgrp/pwd_grp.c
@@ -117,6 +117,18 @@ static struct statics *ptr_to_statics;
117#define S (*ptr_to_statics) 117#define S (*ptr_to_statics)
118#define has_S (ptr_to_statics) 118#define has_S (ptr_to_statics)
119 119
120#if ENABLE_FEATURE_CLEAN_UP
121static void free_static(void)
122{
123 free(S.db[0].malloced);
124 free(S.db[1].malloced);
125# if ENABLE_USE_BB_SHADOW
126 S.db[2].malloced);
127# endif
128 free(ptr_to_statics);
129}
130#endif
131
120static struct statics *get_S(void) 132static struct statics *get_S(void)
121{ 133{
122 if (!ptr_to_statics) { 134 if (!ptr_to_statics) {
@@ -126,6 +138,9 @@ static struct statics *get_S(void)
126#if ENABLE_USE_BB_SHADOW 138#if ENABLE_USE_BB_SHADOW
127 memcpy(&S.db[2], &const_sp_db, sizeof(const_sp_db)); 139 memcpy(&S.db[2], &const_sp_db, sizeof(const_sp_db));
128#endif 140#endif
141#if ENABLE_FEATURE_CLEAN_UP
142 atexit(free_static);
143#endif
129 } 144 }
130 return ptr_to_statics; 145 return ptr_to_statics;
131} 146}