aboutsummaryrefslogtreecommitdiff
path: root/brightnessctl.c
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2020-05-13 13:37:24 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2020-05-13 13:37:24 -0400
commitf099f30489f958c4466b83ecb0427f28b9c11e9d (patch)
tree29e349aff2488d9671f047c33c1ead1195e33bfa /brightnessctl.c
parent1763cf8ac3720104bdd72d5b631eed3b467e69fc (diff)
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.
Diffstat (limited to 'brightnessctl.c')
-rw-r--r--brightnessctl.c2
1 files changed, 1 insertions, 1 deletions
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;