Skip to content

Commit

Permalink
permissions: safety checks when destroying module
Browse files Browse the repository at this point in the history
- avoid warning of freeing null pointers on failed startup

(cherry picked from commit d98d8b6)
(cherry picked from commit aa57ad4)
(cherry picked from commit bad37f2)
  • Loading branch information
miconda committed Jan 28, 2020
1 parent 913f1be commit 82eac3c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/modules/permissions/permissions.c
Expand Up @@ -48,7 +48,7 @@ MODULE_VERSION

static rule_file_t allow[MAX_RULE_FILES]; /* Parsed allow files */
static rule_file_t deny[MAX_RULE_FILES]; /* Parsed deny files */
static int rules_num; /* Number of parsed allow/deny files */
static int rules_num = 0; /* Number of parsed allow/deny files */


/* Module parameter variables */
Expand Down Expand Up @@ -664,11 +664,11 @@ static void mod_exit(void)
int i;

for(i = 0; i < rules_num; i++) {
free_rule(allow[i].rules);
pkg_free(allow[i].filename);
if(allow[i].rules) free_rule(allow[i].rules);
if(allow[i].filename) pkg_free(allow[i].filename);

free_rule(deny[i].rules);
pkg_free(deny[i].filename);
if(deny[i].rules) free_rule(deny[i].rules);
if(deny[i].filename) pkg_free(deny[i].filename);
}

clean_trusted();
Expand Down

0 comments on commit 82eac3c

Please sign in to comment.