1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix memory leak in mkinitrd(1) AddRulesFromFile error path.

This commit is contained in:
Jonas 'Sortie' Termansen 2018-07-16 20:08:29 +02:00
parent e8a9d3dc04
commit f744e80b88

View file

@ -225,15 +225,16 @@ bool AddRulesFromFile(FILE* fp, const char* fpname)
goto error_out;
}
}
free(mem);
if ( ferror(fp) )
{
error_out_errno:
warn("%s", fpname);
error_out:
free(mem);
ChangeRulesAmount(rules_at_start);
return false;
}
free(mem);
return true;
}