[prev in list] [next in list] [prev in thread] [next in thread] 

List:       selinux
Subject:    [PATCH] restorecond memory leaks
From:       Steve G <linux_4ever () yahoo ! com>
Date:       2007-02-20 17:57:47
Message-ID: 20070220175747.16810.qmail () web51504 ! mail ! yahoo ! com
[Download RAW message or body]

Hi,

Attached is a patch addressing memory leaks in restorecond. It still consumes way
too much memory, but this fixes all know leaks and valgrind now reports all
memory freed at exit.

Signed-off-by: Steve Grubb <linux_4ever@yahoo.com>




 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 
["policycoreutils-2.0.1-memleak.patch" (text/x-patch)]

diff -urp policycoreutils-2.0.1.orig/restorecond/restorecond.c \
                policycoreutils-2.0.1/restorecond/restorecond.c
--- policycoreutils-2.0.1.orig/restorecond/restorecond.c	2007-02-19 \
                21:25:54.000000000 -0500
+++ policycoreutils-2.0.1/restorecond/restorecond.c	2007-02-20 12:50:29.000000000 \
-0500 @@ -483,6 +483,8 @@ int main(int argc, char **argv)
 
 	watch_list_free(master_fd);
 	close(master_fd);
+	matchpathcon_fini();
+	utmpwatcher_free();
 	if (pidfile)
 		unlink(pidfile);
 
diff -urp policycoreutils-2.0.1.orig/restorecond/utmpwatcher.c \
                policycoreutils-2.0.1/restorecond/utmpwatcher.c
--- policycoreutils-2.0.1.orig/restorecond/utmpwatcher.c	2007-02-19 \
                21:25:54.000000000 -0500
+++ policycoreutils-2.0.1/restorecond/utmpwatcher.c	2007-02-20 12:51:27.000000000 \
-0500 @@ -101,6 +101,12 @@ void utmpwatcher_add(int inotify_fd, con
 	watch_file(inotify_fd, path);
 }
 
+void utmpwatcher_free(void)
+{
+	if (utmp_ptr)
+		strings_list_free(utmp_ptr);
+}
+
 #ifdef TEST
 int main(int argc, char **argv)
 {
diff -urp policycoreutils-2.0.1.orig/restorecond/utmpwatcher.h \
                policycoreutils-2.0.1/restorecond/utmpwatcher.h
--- policycoreutils-2.0.1.orig/restorecond/utmpwatcher.h	2007-02-19 \
                21:25:54.000000000 -0500
+++ policycoreutils-2.0.1/restorecond/utmpwatcher.h	2007-02-20 12:50:09.000000000 \
-0500 @@ -25,5 +25,6 @@
 
 unsigned int utmpwatcher_handle(int inotify_fd, int wd);
 void utmpwatcher_add(int inotify_fd, const char *path);
+void utmpwatcher_free(void);
 
 #endif


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic