Skip to content

Commit e416eb5

Browse files
committed
Fix more static analysis issues
1 parent ac61e4a commit e416eb5

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

audisp/audispd-pconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ int load_pconfig(plugin_conf_t *config, int dirfd, char *file)
235235
continue;
236236
}
237237
if (nv.values == NULL) {
238+
nv_free(&nv);
238239
fclose(f);
239240
return 1;
240241
}
@@ -543,4 +544,3 @@ void free_pconfig(plugin_conf_t *config)
543544
free((void *)config->path);
544545
free((void *)config->name);
545546
}
546-

audisp/plugins/zos-remote/zos-remote-ldap.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,12 +597,14 @@ static int decode_response(audit_response_t * r, struct berval *bv)
597597
}
598598
rc |= ber_scanf(ber, "}");
599599

600-
if (rc == -1) {
601-
for (; r->numItems > 0; r->numItems--)
602-
free(r->itemList[r->numItems - 1]);
603-
free(r->itemList);
604-
rc = ICTX_E_ABORT;
605-
}
600+
if (rc == -1) {
601+
for (; r->numItems > 0; r->numItems--)
602+
free(r->itemList[r->numItems - 1]);
603+
free(r->itemList);
604+
r->itemList = NULL;
605+
r->numItems = 0;
606+
rc = ICTX_E_ABORT;
607+
}
606608
else
607609
rc = ICTX_SUCCESS;
608610

src/ausearch-string.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ int slist_add_if_uniq(slist *l, const char *str)
122122
sn.str = strdup(str);
123123
sn.key = NULL;
124124
sn.hits = 1;
125-
slist_append(l, &sn);
125+
if (slist_append(l, &sn)) {
126+
free(sn.str);
127+
return -1;
128+
}
126129
return 1;
127130
}
128131

@@ -252,4 +255,3 @@ void slist_sort_by_hits(slist *l)
252255
// End with cur pointing at first record
253256
l->cur = l->head;
254257
}
255-

0 commit comments

Comments
 (0)