Fix file descriptor leak on error in read_mroute_list()

Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
This commit is contained in:
Thomas Jarosch 2011-10-03 05:24:18 +00:00 committed by Stephen Hemminger
parent 67ef60a293
commit e588a7db16

View File

@ -85,8 +85,10 @@ static void read_mroute_list(FILE *ofp)
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)) {
inet_prefix maddr, msrc; inet_prefix maddr, msrc;