[PATCH 42/63] policycoreutils: do not leak memory in restore

[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/

iEYEARECAAYFAk6wTZoACgkQrlYvE4MpobMqJQCeM0OyCipkgTjcZylEqP+PydGw
B+wAnjU5scJEUPQsqqFCcah9+uI19MdY
=V7hF
-----END PGP SIGNATURE-----
>From 6918fe31f868d0a784218e65067fc7528d2c70c5 Mon Sep 17 00:00:00 2001
From: Eric Paris <eparis@xxxxxxxxxx>
Date: Wed, 28 Sep 2011 17:18:45 -0400
Subject: [PATCH 42/63] policycoreutils: do not leak memory in restore

We never freed curcon on a number of exit paths.  Take care of that.

Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
---
 policycoreutils/setfiles/restore.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/policycoreutils/setfiles/restore.c b/policycoreutils/setfiles/restore.c
index 00c0b51..c1395e1 100644
--- a/policycoreutils/setfiles/restore.c
+++ b/policycoreutils/setfiles/restore.c
@@ -255,12 +255,15 @@ static int restore(FTSENT *ftsent)
 	}
 	ret = 1;
 out:
+	freecon(curcon);
 	freecon(newcon);
 	return ret;
 skip:
+	freecon(curcon);
 	freecon(newcon);
 	return SKIP;
 err:
+	freecon(curcon);
 	freecon(newcon);
 	return ERR;
 }
-- 
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