Fix file descriptor leak on error in rtnl_hash_initialize()
Detected by cppcheck. Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
This commit is contained in:
parent
21a5a6b378
commit
97c13582f9
|
|
@ -54,6 +54,7 @@ rtnl_hash_initialize(char *file, struct rtnl_hash_entry **hash, int size)
|
||||||
sscanf(p, "%d %s #", &id, namebuf) != 2) {
|
sscanf(p, "%d %s #", &id, namebuf) != 2) {
|
||||||
fprintf(stderr, "Database %s is corrupted at %s\n",
|
fprintf(stderr, "Database %s is corrupted at %s\n",
|
||||||
file, p);
|
file, p);
|
||||||
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,6 +92,7 @@ static void rtnl_tab_initialize(char *file, char **tab, int size)
|
||||||
sscanf(p, "%d %s #", &id, namebuf) != 2) {
|
sscanf(p, "%d %s #", &id, namebuf) != 2) {
|
||||||
fprintf(stderr, "Database %s is corrupted at %s\n",
|
fprintf(stderr, "Database %s is corrupted at %s\n",
|
||||||
file, p);
|
file, p);
|
||||||
|
fclose(fp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue