Skip to contentSkip to conversation

restorecond memory leaks

PATCH In review Steve G 2 participants 2 messages Feb 20, 2007 – Feb 22, 2007 SELinux security module

lore
Share & tools
lore

Steve G

author
#0 lore raw

PATCH 1/1 restorecond memory leaks

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.

____________________________________________________________________________________
No need to miss a message. Get email on-the-go
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail

restorecond/restorecond.c +2 -0
diff -urp policycoreutils-2.0.1.orig/restorecond/restorecond.c policycoreutils-2.0.1/restorecond/restorecond.c
@@ -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);
 
restorecond/utmpwatcher.c +6 -0
diff -urp policycoreutils-2.0.1.orig/restorecond/utmpwatcher.c policycoreutils-2.0.1/restorecond/utmpwatcher.c
@@ -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)
 {
restorecond/utmpwatcher.h +1 -0
diff -urp policycoreutils-2.0.1.orig/restorecond/utmpwatcher.h policycoreutils-2.0.1/restorecond/utmpwatcher.h
@@ -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
#1 lore raw
Quoted 7 lines · Steve G

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.

Thanks, merged into -trunk and -stable.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.