From: <ssm...@us...> - 2007-02-22 13:59:49
|
Revision: 2257 http://svn.sourceforge.net/selinux/?rev=2257&view=rev Author: ssmalley Date: 2007-02-22 05:59:48 -0800 (Thu, 22 Feb 2007) Log Message: ----------- Ported r2253 through r2255 from trunk. Modified Paths: -------------- branches/stable/1_0/libselinux/src/matchpathcon.c branches/stable/1_0/policycoreutils/restorecond/restorecond.c branches/stable/1_0/policycoreutils/restorecond/utmpwatcher.c branches/stable/1_0/policycoreutils/restorecond/utmpwatcher.h Modified: branches/stable/1_0/libselinux/src/matchpathcon.c =================================================================== --- branches/stable/1_0/libselinux/src/matchpathcon.c 2007-02-22 13:54:45 UTC (rev 2256) +++ branches/stable/1_0/libselinux/src/matchpathcon.c 2007-02-22 13:59:48 UTC (rev 2257) @@ -445,9 +445,9 @@ { int items, len, regerr, ret; char *buf_p, *ptr; - char *regex, *type, *context; + char *regex=NULL, *type=NULL, *context=NULL; const char *reg_buf; - char *anchored_regex; + char *anchored_regex = NULL; ret = 0; len = strlen(line_buf); @@ -488,8 +488,8 @@ if (type) { type = strdup(type); if (!type) { - ret = -1; - goto finish; + free(regex); + return -1; } } context = strdup(context); @@ -543,9 +543,12 @@ path, lineno, anchored_regex, (errbuf ? errbuf : "out of memory")); free(anchored_regex); + anchored_regex = NULL; + free(errbuf); goto finish; } free(anchored_regex); + anchored_regex = NULL; /* Convert the type string to a mode format */ spec_arr[nspec].type_str = type; @@ -718,6 +721,7 @@ } } free(line_buf); + line_buf = NULL; /* Move exact pathname specifications to the end. */ spec_copy = malloc(sizeof(spec_t) * nspec); @@ -740,6 +744,7 @@ status = 0; finish: fclose(fp); + free(line_buf); if (spec_arr != spec_copy) free(spec_arr); if (homedirfp) Modified: branches/stable/1_0/policycoreutils/restorecond/restorecond.c =================================================================== --- branches/stable/1_0/policycoreutils/restorecond/restorecond.c 2007-02-22 13:54:45 UTC (rev 2256) +++ branches/stable/1_0/policycoreutils/restorecond/restorecond.c 2007-02-22 13:59:48 UTC (rev 2257) @@ -481,6 +481,8 @@ watch_list_free(master_fd); close(master_fd); + matchpathcon_fini(); + utmpwatcher_free(); if (pidfile) unlink(pidfile); Modified: branches/stable/1_0/policycoreutils/restorecond/utmpwatcher.c =================================================================== --- branches/stable/1_0/policycoreutils/restorecond/utmpwatcher.c 2007-02-22 13:54:45 UTC (rev 2256) +++ branches/stable/1_0/policycoreutils/restorecond/utmpwatcher.c 2007-02-22 13:59:48 UTC (rev 2257) @@ -101,6 +101,12 @@ 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) { Modified: branches/stable/1_0/policycoreutils/restorecond/utmpwatcher.h =================================================================== --- branches/stable/1_0/policycoreutils/restorecond/utmpwatcher.h 2007-02-22 13:54:45 UTC (rev 2256) +++ branches/stable/1_0/policycoreutils/restorecond/utmpwatcher.h 2007-02-22 13:59:48 UTC (rev 2257) @@ -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 was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |