diff options
author | Eric Paris <eparis@redhat.com> | 2012-11-19 12:42:38 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2013-02-05 20:14:40 -0500 |
commit | d09bcb75f5e7c87ba4b8fd8b55ec28c69a1c94fa (patch) | |
tree | f9433fb3485bba325b25f6a7e14bbd249fef9b44 /libselinux/src/audit2why.c | |
parent | 45b324e27b0955e93371508f9ab79ed8d9e5bb7c (diff) | |
download | android_external_selinux-d09bcb75f5e7c87ba4b8fd8b55ec28c69a1c94fa.tar.gz android_external_selinux-d09bcb75f5e7c87ba4b8fd8b55ec28c69a1c94fa.tar.bz2 android_external_selinux-d09bcb75f5e7c87ba4b8fd8b55ec28c69a1c94fa.zip |
libselinux: audit2why: do not leak on multiple init() calls
If init() was already called then avc will be set. If avc is set just
return.
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libselinux/src/audit2why.c')
-rw-r--r-- | libselinux/src/audit2why.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libselinux/src/audit2why.c b/libselinux/src/audit2why.c index 0c814aab..86574e46 100644 --- a/libselinux/src/audit2why.c +++ b/libselinux/src/audit2why.c @@ -299,6 +299,10 @@ static int __policy_init(const char *init_path) static PyObject *init(PyObject *self __attribute__((unused)), PyObject *args) { int result; char *init_path=NULL; + if (avc) { + PyErr_SetString( PyExc_RuntimeError, "init called multiple times"); + return NULL; + } if (!PyArg_ParseTuple(args,(char *)"|s:policy_init",&init_path)) return NULL; result = __policy_init(init_path); |