Skip to content

Commit

Permalink
Bumped cppcheck version to 2.3
Browse files Browse the repository at this point in the history
addressed resulting warnings
  • Loading branch information
matt335672 committed Dec 31, 2020
1 parent d8998a0 commit 8ab3a2e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ jobs:
env:
CC: gcc
# This is required to use a version of cppcheck other than that
# suplied with the operating system
CPPCHECK_VER: 2.1
# supplied with the operating system
CPPCHECK_VER: 2.3
CPPCHECK_REPO: https://github.com/danmar/cppcheck.git
steps:
- uses: actions/checkout@v2
Expand All @@ -142,4 +142,3 @@ jobs:
- run: ./bootstrap
- run: scripts/install_cppcheck.sh $CPPCHECK_REPO $CPPCHECK_VER
- run: scripts/run_cppcheck.sh -v $CPPCHECK_VER

6 changes: 6 additions & 0 deletions common/pixman-region.c
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,10 @@ validate (region_type_t * badreg)
*badreg = ri[0].reg;

if (ri != stack_regions)
{
/* cppcheck-suppress autovarInvalidDeallocation */
free (ri);
}

GOOD (badreg);
return ret;
Expand All @@ -1809,7 +1812,10 @@ validate (region_type_t * badreg)
FREE_DATA (&ri[i].reg);

if (ri != stack_regions)
{
/* cppcheck-suppress autovarInvalidDeallocation */
free (ri);
}

return pixman_break (badreg);
}
Expand Down
6 changes: 6 additions & 0 deletions scripts/install_cppcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ fi
make_args="FILESDIR=$FILESDIR PREFIX=$FILESDIR CFGDIR=$FILESDIR"
;;
*) make_args="FILESDIR=$FILESDIR PREFIX=$FILESDIR USE_Z3=yes"
# Check that the Z3 development files appear to be installed
# before trying to create z3_version.h. Otherwise we may
# mislead the user as to what needs to be done.
if [ ! -f /usr/include/z3.h ]; then
echo "** libz3-dev (or equivalent) does not appear to be installed" >&2
fi
if [ ! -f /usr/include/z3_version.h ]; then
create_z3_version_h
fi
Expand Down
4 changes: 4 additions & 0 deletions sesman/chansrv/chansrv_xfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ xfs_create_xfs_fs(mode_t umask, uid_t uid, gid_t gid)
xfs->free_list = NULL;
xfs->generation = 1;

/* xfs->inode_table check should be superfluous here, but it
* prevents cppcheck 2.2/2.3 generating a false positive nullPointer
* report */
if (!grow_xfs(xfs, INODE_TABLE_ALLOCATION_INITIAL) ||
xfs->inode_table == NULL ||
(xino1 = g_new0(XFS_INODE_ALL, 1)) == NULL ||
(xino2 = g_new0(XFS_INODE_ALL, 1)) == NULL)
{
Expand Down

0 comments on commit 8ab3a2e

Please sign in to comment.