Bug 28108

Summary: [PATCH] cron leaks memory when reloading crontab files
Product: Base System Reporter: Mark Peek <mark>
Component: binAssignee: dd <dd>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.3-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Mark Peek 2001-06-12 21:50:01 UTC
Based on a cron.core image from my favorite, long running internet server
appliance, I discovered (with help from gdb) that cron was leaking memory.

By code inspection, I discovered 2 leaks.

1. Calls were made to login_getclass() without a cooresponding call to
login_close(). This leaks 1 login_cap_t (plus associated data storage) for
every crontab entry. It appears this bug was introduced back in late 1997.

2. There was a possibility of additional leakage (e->class) due to the way
storage was freed in the error case for the call to entry.c:loadentry().

Fix: Apply the patch below.
How-To-Repeat: Fire up cron and keep touching crontab files to ensure it reloads the files
often. Use ps to check on the memory usage or wait long enough for it to
exhaust its memory limit. (While testing, I also put in a syslog() in to
verify it is leaking the login_cap_t once per entry.)
Comment 1 dd freebsd_committer freebsd_triage 2001-06-13 06:49:42 UTC
State Changed
From-To: open->analyzed

Committed, thanks! 


Comment 2 dd freebsd_committer freebsd_triage 2001-06-13 06:49:42 UTC
Responsible Changed
From-To: freebsd-bugs->dd

My MFC reminder.
Comment 3 dd freebsd_committer freebsd_triage 2001-07-02 02:09:11 UTC
State Changed
From-To: analyzed->closed

MFC'd