parse: detect empty file + fix memleak
This commit is contained in:
@@ -165,8 +165,15 @@ parse_keywords(const char *filename)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (st.st_size == 0) {
|
||||||
|
warnx("%s: empty file", filename);
|
||||||
|
close(fd);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!realpath(filename, path)) {
|
if (!realpath(filename, path)) {
|
||||||
warn("%s", filename);
|
warn("%s", filename);
|
||||||
|
close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user