diff --git a/lib/gshadow.c b/lib/gshadow.c index 4fcbb227d..8f1db29c5 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -140,8 +140,9 @@ void endsgent (void) /*@observer@*//*@null@*/struct sgrp * fgetsgent(/*@null@*/FILE *fp) { - static size_t buflen = 0; - static char *buf = NULL; + char *buf = NULL; + size_t buflen = 0; + struct sgrp *sg; if (NULL == fp) { return NULL; @@ -152,7 +153,11 @@ fgetsgent(/*@null@*/FILE *fp) if (stpsep(buf, "\n") == NULL) return NULL; - return (sgetsgent (buf)); + sg = sgetsgent(buf); + + free(buf); + + return sg; }