[PATCH 58/63] libselinux: audit2why: close fd on enomem

[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.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6wTScACgkQrlYvE4MpobMPQgCgjyzjUcuKFuUpoo+mLMn9vUFH
UksAoJ0Ki8Fdj5AZ9Dg4aj60GXcVbiJR
=Xlmv
-----END PGP SIGNATURE-----
>From b6935682ddcd0d2146a88eb883c8eb67793bef4c Mon Sep 17 00:00:00 2001
From: Dan Walsh <dwalsh@xxxxxxxxxx>
Date: Thu, 27 Oct 2011 10:00:21 -0400
Subject: [PATCH 58/63] libselinux: audit2why: close fd on enomem

Potential file descriptor leak on this code path, need to close file
descriptor if out of memory.

Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
---
 libselinux/src/audit2why.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libselinux/src/audit2why.c b/libselinux/src/audit2why.c
index 62ba02c..1bf3599 100644
--- a/libselinux/src/audit2why.c
+++ b/libselinux/src/audit2why.c
@@ -235,6 +235,7 @@ static int __policy_init(const char *init_path)
 	avc = calloc(sizeof(struct avc_t), 1);
 	if (!avc) {
 		PyErr_SetString( PyExc_MemoryError, "Out of memory\n");
+		fclose(fp);
 		return 1;
 	}
 
-- 
1.7.7


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

  Powered by Linux