Add support for cppcheck 2.17.0

cppcheck 2.17.0 adds checks that a NULL pointer returned from malloc() and
calloc() is not used.

We do this quite a lot.

I've addressed this by adding functions g_malloc_nofail() and
g_calloc_nofail() which either allocate memory or abort.
functions are now called in places where we are not making these
checks.

Many of these checks are in test programs or example programs.

I've modified the list16 module to handle out-of-memory conditions.
This commit is contained in:
matt335672
2025-02-24 11:36:02 +00:00
parent 3446614961
commit 2f46ef27a2
9 changed files with 190 additions and 62 deletions
+1 -1
View File
@@ -181,7 +181,7 @@ jobs:
CC: gcc
# This is required to use a version of cppcheck other than that
# supplied with the operating system
CPPCHECK_VER: "2.16.0"
CPPCHECK_VER: "2.17.0"
CPPCHECK_REPO: https://github.com/danmar/cppcheck.git
steps:
# Set steps.os.outputs.image to the specific OS (e.g. 'ubuntu20')