Fix file descriptor leak on error in read_viftable()

Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
This commit is contained in:
Thomas Jarosch 2011-10-03 05:24:08 +00:00 committed by Stephen Hemminger
parent 25352af7c2
commit 67ef60a293
1 changed files with 3 additions and 2 deletions

View File

@ -58,9 +58,10 @@ static void read_viftable(void)
if (!fp)
return;
if (!fgets(buf, sizeof(buf), fp))
if (!fgets(buf, sizeof(buf), fp)) {
fclose(fp);
return;
}
while (fgets(buf, sizeof(buf), fp)) {
int vifi;
char dev[256];