diff options
author | wpaul <wpaul@FreeBSD.org> | 1995-04-22 17:28:04 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1995-04-22 17:28:04 +0000 |
commit | 3d4135682a102df61c304ca5633ec1729e989714 (patch) | |
tree | 3370b27204b458a20c423465188ec7909d25a0bd /lib/libc/gen/getpwent.c | |
parent | 2a008b93daea698e559571fe8ef9fdd92a69541d (diff) | |
download | FreeBSD-src-3d4135682a102df61c304ca5633ec1729e989714.zip FreeBSD-src-3d4135682a102df61c304ca5633ec1729e989714.tar.gz |
in _freecaches(): strdup() allocates us memory -- remember to free it.
Diffstat (limited to 'lib/libc/gen/getpwent.c')
-rw-r--r-- | lib/libc/gen/getpwent.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 4cfe11a..46482b4 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -461,22 +461,30 @@ struct _pw_cache *p, *m; struct _namelist *n; while (_plushead) { - while(_plushead->namelist) { - n = _plushead->namelist->next; - free(_plushead->namelist); - _plushead->namelist = n; - } + while(_plushead->namelist) { + n = _plushead->namelist->next; + free(_plushead->namelist->name); + free(_plushead->namelist); + _plushead->namelist = n; + } + free(_plushead->pw_entry.pw_name); + free(_plushead->pw_entry.pw_passwd); + free(_plushead->pw_entry.pw_class); + free(_plushead->pw_entry.pw_gecos); + free(_plushead->pw_entry.pw_dir); + free(_plushead->pw_entry.pw_shell); p = _plushead->next; free(_plushead); _plushead = p; } while(_minushead) { - while(_minushead->namelist) { - n = _minushead->namelist->next; - free(_minushead->namelist); - _minushead->namelist = n; - } + while(_minushead->namelist) { + n = _minushead->namelist->next; + free(_minushead->namelist->name); + free(_minushead->namelist); + _minushead->namelist = n; + } m = _minushead->next; free(_minushead); _minushead = m; |