From c009c955fdae64b3ae33f55be15832cad2a3592b Mon Sep 17 00:00:00 2001 From: Denis Kirjanov Date: Thu, 31 Oct 2024 15:14:11 +0300 Subject: [PATCH] lib: utils: close file handle on error reap_prop() doesn't close the file descriptor on some errors, fix it. Signed-off-by: Denis Kirjanov --- lib/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.c b/lib/utils.c index 98c06ab6..5c67e006 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -70,7 +70,6 @@ int read_prop(const char *dev, char *prop, long *value) if (!fgets(buf, sizeof(buf), fp)) { fprintf(stderr, "property \"%s\" in file %s is currently unknown\n", prop, fname); - fclose(fp); goto out; } @@ -95,6 +94,7 @@ int read_prop(const char *dev, char *prop, long *value) *value = result; return 0; out: + fclose(fp); fprintf(stderr, "Failed to parse %s\n", fname); return -1; } -- 2.47.2