Commit 67ef60a2 authored by Thomas Jarosch's avatar Thomas Jarosch Committed by Stephen Hemminger

Fix file descriptor leak on error in read_viftable()

Detected by cppcheck.
Signed-off-by: default avatarThomas Jarosch <thomas.jarosch@intra2net.com>
parent 25352af7
...@@ -58,9 +58,10 @@ static void read_viftable(void) ...@@ -58,9 +58,10 @@ static void read_viftable(void)
if (!fp) if (!fp)
return; return;
if (!fgets(buf, sizeof(buf), fp)) if (!fgets(buf, sizeof(buf), fp)) {
fclose(fp);
return; return;
}
while (fgets(buf, sizeof(buf), fp)) { while (fgets(buf, sizeof(buf), fp)) {
int vifi; int vifi;
char dev[256]; char dev[256];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment