Fix possible leak in parse.c. Fixes #149
If stat() fail and open() worked, file wasn't closed Reported-by: mlq <mlq@pwmt.org> Signed-off-by: Philippe Pepiot <phil@philpep.org>
This commit is contained in:
parent
0400fb5454
commit
b9e67982f8
@ -165,7 +165,7 @@ parse_keywords(const char *filename)
|
|||||||
bool error = False;
|
bool error = False;
|
||||||
|
|
||||||
|
|
||||||
if ((fd = open(filename, O_RDONLY)) == -1 || stat(filename, &st) == -1) {
|
if (stat(filename, &st) == -1 || (fd = open(filename, O_RDONLY)) == -1) {
|
||||||
warn("%s", filename);
|
warn("%s", filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user