Cleanup: close open file before returning

This prevents a resource leak.

Found by Coverity. Fixes CID 350080

The commit also includes some tiny whitespace/empty line fixes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-10-27 06:54:10 -04:00
parent 86b76b0aff
commit ee6b89268e

View file

@ -605,6 +605,7 @@ static bool uemis_get_answer(const char *path, char *request, int n_param_in,
}
if (read(ans_file, tmp, 100) < 0) {
free(ans_path);
close(ans_file);
return false;
}
close(ans_file);