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>
This commit is contained in:
Eric Paris 2012-11-19 12:42:38 -05:00
parent 45b324e27b
commit d09bcb75f5
1 changed files with 4 additions and 0 deletions

View File

@ -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);