-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlD+pugACgkQrlYvE4MpobMa1gCeLC/lYrIcsCjFcgpHSxENrIB4 IhoAoLFHM8rT0WZfiqZyE7cpMHmejr70 =Ki7w -----END PGP SIGNATURE-----
>From ea3e540ed41737f8454c8036f2a1afeca1bd8b21 Mon Sep 17 00:00:00 2001 From: rhatdan <dwalsh@xxxxxxxxxx> Date: Mon, 15 Oct 2012 15:25:31 -0400 Subject: [PATCH 42/84] libselinux: audit2why: Fix segfault if finish() called twice If audit2why.finish is called more than once the global avc variable will be NULL, and thus dereferencing it will obviously cause problems. Thus just bail if avc is NULL and we know cleanup is done. Signed-off-by: Eric Paris <eparis@xxxxxxxxxx> --- libselinux/src/audit2why.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libselinux/src/audit2why.c b/libselinux/src/audit2why.c index 3ea3afe..4dcdfa2 100644 --- a/libselinux/src/audit2why.c +++ b/libselinux/src/audit2why.c @@ -164,6 +164,9 @@ static PyObject *finish(PyObject *self __attribute__((unused)), PyObject *args) if (PyArg_ParseTuple(args,(char *)":finish")) { int i = 0; + if (! avc) + Py_RETURN_NONE; + for (i = 0; i < boolcnt; i++) { free(boollist[i]->name); free(boollist[i]); @@ -177,7 +180,7 @@ static PyObject *finish(PyObject *self __attribute__((unused)), PyObject *args) avc = NULL; boollist = NULL; boolcnt = 0; - + /* Boilerplate to return "None" */ Py_RETURN_NONE; } -- 1.8.1