Plug a file descriptor leak.
Reported by: Coverity CID: 1238916 MFC after: 1 week
This commit is contained in:
parent
be930504be
commit
0a8534f083
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272140
@ -305,11 +305,13 @@ kvp_file_init(void)
|
||||
|
||||
filep = fopen(fname, "r");
|
||||
if (!filep) {
|
||||
close(fd);
|
||||
return (1);
|
||||
}
|
||||
|
||||
record = malloc(alloc_unit * num_blocks);
|
||||
if (record == NULL) {
|
||||
close(fd);
|
||||
fclose(filep);
|
||||
return (1);
|
||||
}
|
||||
@ -334,6 +336,7 @@ kvp_file_init(void)
|
||||
record = realloc(record, alloc_unit *
|
||||
num_blocks);
|
||||
if (record == NULL) {
|
||||
close(fd);
|
||||
fclose(filep);
|
||||
return (1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user