[ZBX-10177] Resource leak in sensors.c reported by Coverity Created: 2015 Dec 17 Updated: 2017 May 30 Resolved: 2015 Dec 31 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G) |
Affects Version/s: | 2.2.12rc1, 2.4.8rc1, 3.0.0alpha5 |
Fix Version/s: | 2.2.12rc1, 2.4.8rc1, 3.0.0alpha6 |
Type: | Incident report | Priority: | Trivial |
Reporter: | Glebs Ivanovskis (Inactive) | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | agent, memoryleak, sensors | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Linux 2.6 and higher |
Description |
In src/libs/zbxsysinfo/linux/sensors.c in function get_device_sensors() we have: if (NULL == (devicedir = opendir(hwmon_dir))) return; while (NULL != (deviceent = readdir(devicedir))) { ... if (NULL == (sensordir = opendir(devicepath))) return; ... } closedir(devicedir); Apparently, second return must be replaced with goto out; and out: must be placed before closedir(devicedir). |
Comments |
Comment by Glebs Ivanovskis (Inactive) [ 2015 Dec 21 ] |
Fix for version 2.2 is available in development branch svn://svn.zabbix.com/branches/dev/ZBX-10177-22 revision 57298. |
Comment by Andris Zeila [ 2015 Dec 22 ] |
Successfully tested |
Comment by Glebs Ivanovskis (Inactive) [ 2015 Dec 23 ] |
Fixed in pre-2.2.12rc1 r57349, pre-2.4.8.rc1 r57350, pre-3.0.0alpha6 (trunk) r57351. |
Comment by Sandis Neilands (Inactive) [ 2015 Dec 29 ] |
Thanks! This fixes Coverity issue CID 118927. |