libselinux: fix python audit2why binding error

There is a missing error check in audit2why.c.  Check for error and
return NULL if we can't initialize instead of just pretending it worked.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
Eric Paris 2011-06-29 00:29:21 -04:00
parent 63df0f7ef1
commit 2ea80c28a5

View file

@ -287,8 +287,9 @@ static int __policy_init(const char *init_path)
static PyObject *init(PyObject *self __attribute__((unused)), PyObject *args) {
int result;
char *init_path=NULL;
if (PyArg_ParseTuple(args,(char *)"|s:policy_init",&init_path))
result = __policy_init(init_path);
if (!PyArg_ParseTuple(args,(char *)"|s:policy_init",&init_path))
return NULL;
result = __policy_init(init_path);
return Py_BuildValue("i", result);
}