PeterHuewe / tpm-emulator

The famous tpm-emulator by Mario Strasser, previously hosted on BerliOs. It supports TPM1.2 only!
GNU General Public License v2.0
177 stars 75 forks source link

fix the problem of memory leak when invoking "tpmd_disconnect" #32

Closed shipinsky closed 6 years ago

shipinsky commented 6 years ago

I maked a experiment by invoking tpmd_connect and tpmd_disconnect many times. Then, i found memory leak by entering command "cat /proc/slabinfo | grep sock_inode_cache". After studing the the code of function sock_release, i realized tpmd_sock->ops->release not free memory. Free memory is realized by iput(SOCK_INODE(sock)). So, i think we should use sock_release instand of tpmd_sock->ops->release.

alonbl commented 6 years ago

@PeterHuewe what about this one?

PeterHuewe commented 6 years ago

Yup - also right. Thanks for fixing this. - Merged