We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent decf456 commit 3e3b374Copy full SHA for 3e3b374
lib/gshadow.c
@@ -140,19 +140,23 @@ void endsgent (void)
140
/*@observer@*//*@null@*/struct sgrp *
141
fgetsgent(/*@null@*/FILE *fp)
142
{
143
- static size_t buflen = 0;
144
- static char *buf = NULL;
+ char *buf = NULL;
+ size_t buflen = 0;
145
+ struct sgrp *sg;
146
- if (NULL == fp) {
147
+ if (NULL == fp)
148
return NULL;
- }
149
150
if (getline(&buf, &buflen, fp) == -1)
151
152
if (stpsep(buf, "\n") == NULL)
153
154
155
- return (sgetsgent (buf));
+ sg = sgetsgent(buf);
156
+
157
+ free(buf);
158
159
+ return sg;
160
}
161
162
0 commit comments