From f099f30489f958c4466b83ecb0427f28b9c11e9d Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Wed, 13 May 2020 13:37:24 -0400 Subject: Avoid a potential uninitialized use If `read_device` fails to open a directory, it frees `ent_path` without ever assigning to it. Explicitly initialize `ent_path` with `NULL` to prevent that uninitialized use. --- brightnessctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brightnessctl.c b/brightnessctl.c index 1629a35..31a066d 100644 --- a/brightnessctl.c +++ b/brightnessctl.c @@ -434,7 +434,7 @@ bool read_device(struct device *d, char *class, char *id) { DIR *dirp; FILE *f; char *dev_path = NULL; - char *ent_path; + char *ent_path = NULL; int error = 0; struct dirent *ent; bool cur; -- cgit v1.2.3