summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Camera <skonfig@dtnr.ch>2022-08-25 22:26:28 +0200
committerDennis Camera <skonfig@dtnr.ch>2022-08-25 22:26:28 +0200
commit4ca677ef422cb0e3aef46d00f2718ce7f0317c6d (patch)
tree580f27051a9abb14ff95ab9447fe4495613cdbb3
parent5ab7ba4aa0095e53024f055952f89f2653a32c97 (diff)
downloadskonfig-c-feature/fanalyzer.tar.gz
skonfig-c-feature/fanalyzer.zip
Break the code to make it compile with -fanalyzerfeature/fanalyzer
-rw-r--r--src/util/envp.c4
-rw-r--r--src/util/fs.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/util/envp.c b/src/util/envp.c
index 26e4b14..7c4853b 100644
--- a/src/util/envp.c
+++ b/src/util/envp.c
@@ -179,6 +179,10 @@ void envp_merge(envp_t *dest, envp_t *const src) {
free(vdup);
continue;
}
+
+ /* FIXME: vdup must NOT be free()d here. It produces uses after free but
+ * makes the GCC analyzer happy. */
+ free(vdup);
}
}
diff --git a/src/util/fs.c b/src/util/fs.c
index 16a2c36..8a192b6 100644
--- a/src/util/fs.c
+++ b/src/util/fs.c
@@ -146,7 +146,8 @@ void which(
path = strdup(search_path);
}
#ifdef _CS_PATH
- if (NULL == search_path) {
+ /* if (NULL == search_path) { */ /* <-- this line produces a leak warning */
+ else {
/* fall back to POSIX path */
size_t pathlen = confstr(_CS_PATH, NULL, 0);
path = malloc(pathlen);