diff --git a/lib/gshadow.c b/lib/gshadow.c index 96b3965b8..a64316990 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -130,8 +130,9 @@ sgetsgent(const char *string) /*@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; @@ -142,7 +143,11 @@ fgetsgent(/*@null@*/FILE *fp) if (stpsep(buf, "\n") == NULL) return NULL; - return (sgetsgent (buf)); + sg = sgetsgent(buf); + + free(buf); + + return sg; }