Bug 171587 - More cleanups and fixes for memory leaks
Summary: More cleanups and fixes for memory leaks
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: logrotate
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-10-23 22:55 UTC by Mateus César Gröess
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-10-25 12:14:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch for cleanups and memory leaks fixes (15.09 KB, patch)
2005-10-23 22:55 UTC, Mateus César Gröess
no flags Details | Diff
New version of the patch, that removes one more line which was causing problems. (15.36 KB, patch)
2005-10-24 12:27 UTC, Mateus César Gröess
no flags Details | Diff
Corrected patch. (15.36 KB, patch)
2005-10-24 18:41 UTC, Mateus César Gröess
no flags Details | Diff

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.


Note You need to log in before you can comment on or make changes to this bug.