aboutsummaryrefslogtreecommitdiff
path: root/src/regions.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-08-18 00:17:35 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-08-18 00:17:35 +0300
commitab011165cd440b5535d39febd8118e3e26b64b57 (patch)
tree0f021b40bbcd9df6efdb5879832acac17ae254bb /src/regions.c
parente38ce698c0e53473a4540e940b25b6093da84cb7 (diff)
downloadkmi-ab011165cd440b5535d39febd8118e3e26b64b57.tar.gz
kmi-ab011165cd440b5535d39febd8118e3e26b64b57.zip
small fixes to issues reported by analyzer
+ Currently analyzer has to be run manually with something like make CFLAGS='-fanalyzer -Wno-analyzer-infinite-loop' I use an infinite loop as an assert, I know it's not great/technically UB but it's just a fallback. + Analyzer is still somewhat limited, I could add in more attributes about different functions, such as memory allocation sizes etc. + If I ever set up a CI pipeline, remember to use analyzer?
Diffstat (limited to 'src/regions.c')
-rw-r--r--src/regions.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/regions.c b/src/regions.c
index 4d82420..9849ba8 100644
--- a/src/regions.c
+++ b/src/regions.c
@@ -374,6 +374,9 @@ struct mem_region *find_first_region(struct mem_region_root *r)
/* get used region with smallest address, likely also close to the start
* of the linked list */
struct mem_region *m = find_closest_used_region(r, 0);
+ if (!m)
+ return NULL;
+
while (m->prev) {
m = m->prev;
}