[PATCH 44/84] libselinux: audit2why: do not leak on multiple init()

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

 



-----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+pwcACgkQrlYvE4MpobO59ACgyG+G5Hzb4m4yVgrK5CFDMko6
YGUAoLOV4Fu5a3pwDl/pToMWpAXTa264
=mN91
-----END PGP SIGNATURE-----
>From bf5b4862e7a4e56bce7944667c852ccc658077b9 Mon Sep 17 00:00:00 2001
From: Eric Paris <eparis@xxxxxxxxxx>
Date: Mon, 19 Nov 2012 12:42:38 -0500
Subject: [PATCH 44/84] 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@xxxxxxxxxx>
---
 libselinux/src/audit2why.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libselinux/src/audit2why.c b/libselinux/src/audit2why.c
index 4dcdfa2..242f2b2 100644
--- a/libselinux/src/audit2why.c
+++ b/libselinux/src/audit2why.c
@@ -275,6 +275,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);
-- 
1.8.1


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

  Powered by Linux