Bugfix/add makefile lint fix warnings (#39)

* fix warnings indicated by scan-build lint tool

* add lint target to makefile using scan-build tool

* add lint into build script stages (note: uses scan-build-7)

* fix potential use of memory after it is freed
This commit is contained in:
Steve Karg
2020-01-28 18:48:29 -06:00
committed by GitHub
parent f8ce70470c
commit 914f502cff
18 changed files with 157 additions and 105 deletions
+3 -2
View File
@@ -75,7 +75,7 @@ static int CheckArraySize(OS_Keylist list)
{
int new_size = 0; /* set it up so that no size change is the default */
const int chunk = 8; /* minimum number of nodes to allocate memory for */
struct Keylist_Node **new_array; /* new array of nodes, if needed */
struct Keylist_Node **new_array = NULL; /* new array of nodes, if needed */
int i; /* counter */
if (!list) {
return FALSE;
@@ -91,7 +91,8 @@ static int CheckArraySize(OS_Keylist list)
}
if (new_size) {
/* Allocate more room for node pointer array */
new_array = calloc((size_t)new_size, sizeof(new_array));
new_array = calloc((size_t)new_size,
sizeof(struct Keylist_Node *));
/* See if we got the memory we wanted */
if (!new_array) {