aboutsummaryrefslogtreecommitdiff
path: root/libpwdgrp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-01-03 16:09:05 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2015-01-03 16:09:05 +0100
commit9dca6acaac3a49f1ff8ba9d3ca78853da6f59ae1 (patch)
tree6d64070daa4761ac5fef12fede8b17638a059e4c /libpwdgrp
parent8d547aca75f8b096976a472714241acd4328be46 (diff)
downloadbusybox-w32-9dca6acaac3a49f1ff8ba9d3ca78853da6f59ae1.tar.gz
busybox-w32-9dca6acaac3a49f1ff8ba9d3ca78853da6f59ae1.tar.bz2
busybox-w32-9dca6acaac3a49f1ff8ba9d3ca78853da6f59ae1.zip
libpwdgrp: reinstate Tito's optional atexit freeing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libpwdgrp')
-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}