Skip to content

Commit 03f1ead

Browse files
committed
Fix auparse leak on exit
1 parent 44679d4 commit 03f1ead

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

auparse/interpret.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,8 @@ const char *_auparse_lookup_interpretation(const char *name)
516516

517517
void free_interpretation_list(void)
518518
{
519-
if (il.cnt != NEVER_LOADED) {
520-
nvlist_clear(&il, 0);
521-
il.cnt = NEVER_LOADED;
522-
}
519+
nvlist_clear(&il, 0);
520+
il.cnt = NEVER_LOADED;
523521
}
524522

525523
// This uses a sentinel to determine if the list has ever been loaded.

auparse/interpret.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include "rnode.h"
3030
#include <time.h>
3131

32+
#define NEVER_LOADED 0xFFFF
33+
3234
/* Make these hidden to prevent conflicts */
3335
AUDIT_HIDDEN_START
3436

auparse/nvlist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void nvlist_clear(nvlist *l, int free_interp)
164164
unsigned int i = 0;
165165
register nvnode *current;
166166

167-
while (i < l->cnt) {
167+
while (i < l->cnt && l->cnt != NEVER_LOADED) {
168168
current = &l->array[i];
169169
if (free_interp) {
170170
free(current->interp_val);

0 commit comments

Comments
 (0)