Skip to content

Commit

Permalink
libsepol: reset pointer after free
Browse files Browse the repository at this point in the history
In cil_strpool_destroy(), cil_strpool_tab is freed but it is not reset to NULL.
When cil_strpool_init() is called again it assumes that cil_strpool_tab was
already initialized. Other functions then work with invalid data.

Signed-off-by: Jan Zarsky <jzarsky@redhat.com>
  • Loading branch information
janzarsky authored and jwcart2 committed Aug 28, 2017
1 parent 53bb2a1 commit 1346746
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libsepol/cil/src/cil_strpool.c
Expand Up @@ -119,6 +119,7 @@ void cil_strpool_destroy(void)
if (cil_strpool_readers == 0) {
hashtab_map(cil_strpool_tab, cil_strpool_entry_destroy, NULL);
hashtab_destroy(cil_strpool_tab);
cil_strpool_tab = NULL;
}
pthread_mutex_unlock(&cil_strpool_mutex);
}

0 comments on commit 1346746

Please sign in to comment.