Bug 171587

Summary: More cleanups and fixes for memory leaks
Product: [Fedora] Fedora Reporter: Mateus César Gröess <mateuscg>
Component: logrotateAssignee: Peter Vrabec <pvrabec>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-25 12:14:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch for cleanups and memory leaks fixes
none
New version of the patch, that removes one more line which was causing problems.
none
Corrected patch. none

Description Mateus César Gröess 2005-10-23 22:55:04 UTC
Hi, I have created another patch to fix some memory leaks, close files and do
cleanups. It contains:

- free() and close() where needed;
- defConfig setup moved from logrotate.c to config.c;
- pointers of compression options are set only by allocated strings, so I could
include them in free_logInfo(), to free() properly when someone set them by
configuration file;
- new function createOutputFile(), which contains code that was duplicated in
three functions of logrotate.c;
- other minor things, let's see if this time I didn't break something.

One note:

      - In copyTruncate() (logrotate.c), I have changed the creation of output
file to use the new function createOutputFile(), but before the open() function
was between two blocks of SELINUX code and the fchmod/fchown functions were
after the second block. Now the fchmod/fchown() functions are inside the
function createOutputFile, which I put between the two blocks of SELINUX, as the
open() function was localized. I don't know how SELINUX work, so I need help
from someone to tell if this change can be a problem.

Comment 1 Mateus César Gröess 2005-10-23 22:55:04 UTC
Created attachment 120296 [details]
Patch for cleanups and memory leaks fixes

Comment 2 Mateus César Gröess 2005-10-24 12:27:30 UTC
Created attachment 120302 [details]
New version of the patch, that removes one more line which was causing problems.

Comment 3 Peter Vrabec 2005-10-24 14:30:14 UTC
U wanted type "free(newlog->uncompress_prog);" in hunk @@ -903,6 +927,7 @@ didn't u?

Comment 4 Mateus César Gröess 2005-10-24 17:43:34 UTC
Yes, I forgot to change that after copy & paste, sorry.

Comment 5 Mateus César Gröess 2005-10-24 18:41:25 UTC
Created attachment 120313 [details]
Corrected patch.