Re: [PATCH] libsepol: reset pointer after free

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/25/2017 05:46 AM, Jan Zarsky wrote:
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@xxxxxxxxxx>

Applied.

Thanks,
Jim

---
  libsepol/cil/src/cil_strpool.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/libsepol/cil/src/cil_strpool.c b/libsepol/cil/src/cil_strpool.c
index b1396d2..97d4c4b 100644
--- a/libsepol/cil/src/cil_strpool.c
+++ b/libsepol/cil/src/cil_strpool.c
@@ -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);
  }



--
James Carter <jwcart2@xxxxxxxxxxxxx>
National Security Agency



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux