Changeset 433
- Timestamp:
- Apr 29, 2013, 7:32:19 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/Changelog
r432 r433 1 1 3.0.12: 2 * Fix for incorrect use of sh_inotify_add_watch_later 3 which causes a steady increase in memory usage 4 (issue reported by Maxime V) 5 * Fix for potential minor memory leak 2 6 * Fix for bug in negated conditionals for config file 3 7 (reported by M. Ward) -
trunk/include/samhain.h
r415 r433 208 208 #define SH_INOTIFY_NEEDINIT (1<<2) 209 209 #define SH_INOTIFY_INSCAN (1<<3) 210 #define SH_INOTIFY_IFUSED(a) if ((sh.flag.inotify & SH_INOTIFY_USE) != 0) { a } 210 211 211 212 -
trunk/src/samhain.c
r424 r433 2023 2023 (flag_check_1 == 1 || flag_check_2 == 1)) 2024 2024 { 2025 sh.flag.inotify |= SH_INOTIFY_INSCAN;2025 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_INSCAN; ); 2026 2026 /* Refresh list files matching glob patterns. 2027 2027 */ … … 2088 2088 flag_check_2 = 0; 2089 2089 check_done = 1; 2090 sh.flag.inotify &= ~SH_INOTIFY_INSCAN;2091 sh.flag.inotify &= ~SH_INOTIFY_DOSCAN;2090 SH_INOTIFY_IFUSED( sh.flag.inotify &= ~SH_INOTIFY_INSCAN; ); 2091 SH_INOTIFY_IFUSED( sh.flag.inotify &= ~SH_INOTIFY_DOSCAN; ); 2092 2092 2093 2093 (void) sh_prelink_run (NULL, NULL, 0); -
trunk/src/sh_fInotify.c
r426 r433 130 130 { 131 131 /* Init from main thread */ 132 sh.flag.inotify |= SH_INOTIFY_DOSCAN;133 sh.flag.inotify |= SH_INOTIFY_NEEDINIT;132 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_DOSCAN; ); 133 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; ); 134 134 135 135 if (0 == sh_pthread_create(sh_threaded_module_run, (void *)arg)) … … 154 154 /* Reconfigure from main thread */ 155 155 /* sh_fInotify_init_internal(); */ 156 sh.flag.inotify |= SH_INOTIFY_DOSCAN;157 sh.flag.inotify |= SH_INOTIFY_NEEDINIT;156 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_DOSCAN; ); 157 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; ); 158 158 return SH_MOD_THREAD; 159 159 } … … 226 226 { 227 227 count = 0; /* Re-expand glob patterns to discover added files. */ 228 sh.flag.inotify |= SH_INOTIFY_INSCAN;228 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_INSCAN; ); 229 229 sh_files_check_globFilePatterns(); 230 sh.flag.inotify &= ~SH_INOTIFY_INSCAN;231 sh.flag.inotify |= SH_INOTIFY_NEEDINIT;230 SH_INOTIFY_IFUSED( sh.flag.inotify &= ~SH_INOTIFY_INSCAN; ); 231 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; ); 232 232 } 233 233 … … 396 396 * DOSCAN is finished, hence wouldn't call init(). 397 397 */ 398 sh.flag.inotify &= ~SH_INOTIFY_NEEDINIT;398 SH_INOTIFY_IFUSED( sh.flag.inotify &= ~SH_INOTIFY_NEEDINIT; ); 399 399 400 400 return 0; … … 474 474 else if ((event->mask & IN_Q_OVERFLOW) != 0) 475 475 { 476 sh.flag.inotify |= SH_INOTIFY_DOSCAN; 477 sh.flag.inotify |= SH_INOTIFY_NEEDINIT; 476 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_DOSCAN; ); 477 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; ); 478 478 479 SH_MUTEX_LOCK(mutex_thread_nolog); 479 480 sh_error_handle(SH_ERR_WARN, FIL__, __LINE__, event->wd, MSG_E_SUBGEN, … … 639 640 if (event->mask & IN_ISDIR) 640 641 { 641 sh.flag.inotify |= SH_INOTIFY_INSCAN;642 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_INSCAN; ); 642 643 sh_files_checkdir (classD, check_maskD, rdepthD, 643 644 path, (event->len > 0) ? event->name : NULL); 644 sh.flag.inotify &= ~SH_INOTIFY_INSCAN;645 sh.flag.inotify |= SH_INOTIFY_NEEDINIT;645 SH_INOTIFY_IFUSED( sh.flag.inotify &= ~SH_INOTIFY_INSCAN; ); 646 SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; ); 646 647 sh_dirs_reset (); 647 648 sh_files_reset (); -
trunk/src/sh_files.c
r425 r433 2010 2010 if (theFile->link_path) SH_FREE(theFile->link_path); 2011 2011 SH_FREE(theFile); 2012 SH_FREE(tmpname); 2012 2013 SL_RETURN((0), _("sh_files_checkdir")); 2013 2014 } … … 2015 2016 if (status == -1) 2016 2017 { 2017 SH_FREE(tmpname);2018 2018 if (theFile->attr_string) SH_FREE(theFile->attr_string); 2019 2019 if (theFile->link_path) SH_FREE(theFile->link_path); 2020 2020 SH_FREE(theFile); 2021 SH_FREE(tmpname); 2021 2022 SL_RETURN((-1), _("sh_files_checkdir")); 2022 2023 } … … 2028 2029 tmpname); 2029 2030 ++sh.statistics.files_nodir; 2030 SH_FREE(tmpname);2031 2031 if (theFile->attr_string) SH_FREE(theFile->attr_string); 2032 2032 if (theFile->link_path) SH_FREE(theFile->link_path); 2033 2033 SH_FREE(theFile); 2034 SH_FREE(tmpname); 2034 2035 SL_RETURN((-1), _("sh_files_checkdir")); 2035 2036 } … … 2127 2128 { 2128 2129 SH_FREE(theDir); 2130 SH_FREE(tmpname); 2129 2131 SL_RETURN((0), _("sh_files_checkdir")); 2130 2132 } … … 2366 2368 SH_FREE(theDir); 2367 2369 sh_dummy_dirlist = NULL; 2370 SH_FREE(tmpname); 2368 2371 SL_RETURN((0), _("sh_files_checkdir")); 2369 2372 }
Note:
See TracChangeset
for help on using the changeset viewer.