Bug 1587980

Summary: pam_mysql memory leak
Product: [Fedora] Fedora EPEL Reporter: Alexander Bersenev <bay>
Component: pam_mysqlAssignee: Paul P Komkoff Jr <i>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: i, manuel.wolfshant, nathanael, rbarlow
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-10 23:19:57 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:
Attachments:
Description Flags
the patch none

Description Alexander Bersenev 2018-06-06 12:04:35 UTC
Created attachment 1448299 [details]
the patch

Description of problem:
There is a known a memory leak in pam_mysql since 2009. The leak happens because mysql_library_end call is missing.

The discussion is available by this link: https://sourceforge.net/p/pam-mysql/bugs/27/

Version-Release number of selected component (if applicable):
0.7RC1

How reproducible:
Always if it works for some time

Steps to Reproduce:
Launch saslauthd configured to use pam_mysql and wait for some time.

Actual results:
Memory leaks

Expected results:
Memory doesn't leak

Comment 1 Nathanael Noblet 2018-07-27 16:21:32 UTC
yeah I can confirm I've known about this bug for years. I didn't know there was a solution however.

There's a discussion here https://sourceforge.net/p/pam-mysql/bugs/27/#c2aa and the patch there as well. I've applied it to a epel7 build and am running it now.
Sorry for the inline patch, but I'm lazy. :)


--- pam_mysql-0.7RC1/pam_mysql.c.org	2018-07-27 10:16:52.781480556 -0600
+++ pam_mysql-0.7RC1/pam_mysql.c	2018-07-27 10:17:23.731647527 -0600
@@ -2338,6 +2338,7 @@
 	}
 
 	mysql_close(ctx->mysql_hdl);
+	mysql_library_end();
 
 	xfree(ctx->mysql_hdl);
 	ctx->mysql_hdl = NULL;

Comment 2 Fedora Update System 2018-12-01 13:18:25 UTC
pam_mysql-0.8.1-0.2.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-bb07632c10

Comment 3 Fedora Update System 2018-12-01 13:18:40 UTC
pam_mysql-0.8.1-0.2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-e600272170

Comment 4 Fedora Update System 2018-12-02 07:54:29 UTC
pam_mysql-0.8.1-0.2.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-bb07632c10

Comment 5 Fedora Update System 2018-12-02 10:10:19 UTC
pam_mysql-0.8.1-0.2.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-e600272170

Comment 6 Randy Barlow 2018-12-10 23:19:57 UTC
An update associated with this bug has been pushed to stable.

Comment 7 Randy Barlow 2018-12-11 17:04:09 UTC
A Fedora update associated with this bug has been pushed to the stable repository.

Comment 8 Randy Barlow 2018-12-14 20:41:19 UTC
A Fedora update associated with this bug has been pushed to the stable repository.