Page MenuHomeFreeBSD

bsnmpd/snmp_hostres: fix hrFSTable remoteMountPoint leak
ClosedPublic

Authored by oshogbo on Tue, Jun 16, 11:27 AM.
Tags
None
Referenced Files
F160380949: D57604.diff
Tue, Jun 23, 10:32 PM
F160345997: D57604.diff
Tue, Jun 23, 12:59 PM
Unknown Object (File)
Sun, Jun 21, 9:56 PM
Unknown Object (File)
Sat, Jun 20, 1:45 PM
Unknown Object (File)
Fri, Jun 19, 11:59 AM
Unknown Object (File)
Thu, Jun 18, 10:53 AM
Unknown Object (File)
Wed, Jun 17, 9:13 PM
Unknown Object (File)
Wed, Jun 17, 6:57 AM
Subscribers

Details

Summary

Free the previous value before re-strdup'ing, and initialise
remoteMountPoint to NULL in fs_entry_create() so the free() is safe on
the newly-created path

Observed via a dtrace leak snapshot on 15.0-RELEASE-p4:

data leaked = 1983, count = 1683

libc.so.7`malloc+0xa8
snmp_hostres.so.6`fs_tbl_process_statfs_entry+0x276
snmp_hostres.so.6`refresh_storage_tbl+0x502
snmp_hostres.so.6`op_hrStorageTable+0x1a
libbsnmp.so.7`0x2a2b1892ba3d
libbsnmp.so.7`snmp_getbulk+0x37f

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73906
Build 70789: arc lint + arc unit