diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-01-03 18:09:05 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-01-03 18:09:05 +0300 |
commit | 9dca6acaac3a49f1ff8ba9d3ca78853da6f59ae1 (patch) | |
tree | 6d64070daa4761ac5fef12fede8b17638a059e4c | |
parent | 8d547aca75f8b096976a472714241acd4328be46 (diff) |
libpwdgrp: reinstate Tito's optional atexit freeing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libpwdgrp/pwd_grp.c | 15 |
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; #define S (*ptr_to_statics) #define has_S (ptr_to_statics) +#if ENABLE_FEATURE_CLEAN_UP +static void free_static(void) +{ + free(S.db[0].malloced); + free(S.db[1].malloced); +# if ENABLE_USE_BB_SHADOW + S.db[2].malloced); +# endif + free(ptr_to_statics); +} +#endif + static struct statics *get_S(void) { if (!ptr_to_statics) { @@ -126,6 +138,9 @@ static struct statics *get_S(void) #if ENABLE_USE_BB_SHADOW memcpy(&S.db[2], &const_sp_db, sizeof(const_sp_db)); #endif +#if ENABLE_FEATURE_CLEAN_UP + atexit(free_static); +#endif } return ptr_to_statics; } |