Bug 985256

Summary: Rsyslog (5.8.10-2.el6) memory leak
Product: Red Hat Enterprise Linux 6 Reporter: gregory.nuyttens
Component: rsyslogAssignee: Tomas Heinrich <theinric>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: gregory.nuyttens, pvrabec
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-24 11:45:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description gregory.nuyttens 2013-07-17 08:07:37 UTC
Description of problem:
In rsyslog we can resets all configuration variables to their default value with the global value $ResetConfigVariables but in the module code of imfile we have that (rsyslog-5.8.10-6.el6.src.rpm) we have that:

static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
{
	DEFiRet;

	if(pszFileName != NULL) {
		free(pszFileName);
		pszFileName = NULL;
	}

	if(pszFileTag != NULL) {
		free(pszFileTag);
		pszFileTag = NULL;
	}	
  
	if(pszStateFile != NULL) {
		free(pszFileTag);
		pszFileTag = NULL;
	}


	/* set defaults... */
	iPollInterval = 10;
	iFacility = 128; /* local0 */
	iSeverity = 5;  /* notice, as of rfc 3164 */
	readMode = 0;
	pBindRuleset = NULL;

	RETiRet;
}

where 
	if(pszStateFile != NULL) {
		free(pszFileTag);
		pszFileTag = NULL;
	}

seems to be a copy/paste error. 

Version-Release number of selected component (if applicable):
All 5.* versions (also be reproducible on Redhat Enterprise Linux 5 with package rsyslog5)

Actual results:
	if(pszStateFile != NULL) {
		free(pszFileTag);
		pszFileTag = NULL;
	}

Expected results:
	if(pszStateFile != NULL) {
		free(pszStateFile);
		pszStateFile = NULL;
	}

===================
Grégory Nuyttens
Smals - Linux System Engineer
Tel +32 2/787 58 79

Comment 2 Tomas Heinrich 2013-07-23 15:50:17 UTC
Hello Gregory, thanks for the report.

The code is clearly wrong, but I can't see the leak in valgrind. From looking at the code it seems that there's now way the value can be leaked. There's one possible negative side effect that a subsequent $InputRunFileMonitor would reuse the value used in the previous one if no other value is defined, but that can be considered an error in the configuration.

So I'm inclined not to patch this as not to break something else. Do you experience some negative effects of the current status?

Comment 3 gregory.nuyttens 2013-07-24 08:00:55 UTC
Hi Tomas,

I'm agree with you and I don't have at this time bad experience about this *bug*.
If I encounter some negative effects, I will come back to you :-)

I believe that we can consider this report only for a "better" code in next versions.

Thanks for your consideration.

Comment 4 Tomas Heinrich 2013-07-24 11:45:13 UTC
Thanks for confirmation. Feel free to reopen if anything pops up.