Fix file descriptor leak on error in read_igmp()

Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
This commit is contained in:
Thomas Jarosch 2011-10-03 05:24:44 +00:00 committed by Stephen Hemminger
parent 297452a1c2
commit 19bcc05bea

View File

@ -128,8 +128,10 @@ void read_igmp(struct ma_info **result_p)
if (!fp)
return;
memset(&m, 0, sizeof(m));
if (!fgets(buf, sizeof(buf), fp))
if (!fgets(buf, sizeof(buf), fp)) {
fclose(fp);
return;
}
m.addr.family = AF_INET;
m.addr.bitlen = 32;