Searched hist:fd99905b4591a5e4df3dda32e4c67258aaf44517 (Results 1 – 2 of 2) sorted by relevance
/freebsd/lib/libiscsiutil/ |
H A D | keys.c | diff fd99905b4591a5e4df3dda32e4c67258aaf44517 Wed Dec 22 19:41:01 CET 2021 John Baldwin <jhb@FreeBSD.org> libiscsiutil: Fix a memory leak with negotiation keys.
When keys are loaded from a received PDU, a copy of the received keys block is saved in the keys struct and the name and value pointers point into that saved block. Freeing the keys frees this block.
However, when keys are added to a keys struct to build a set of keys later sent in a PDU, the keys data block pointer is not used and individual key names and values hold allocated strings. When the keys structure was freed, all of these individual key name and value strings were leaked.
Instead, allocate copies of strings for names and values when parsing a set of keys from a received PDU and free all of the individual key name and value strings when deleting a set of keys.
Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D33545
|
H A D | libiscsiutil.h | diff fd99905b4591a5e4df3dda32e4c67258aaf44517 Wed Dec 22 19:41:01 CET 2021 John Baldwin <jhb@FreeBSD.org> libiscsiutil: Fix a memory leak with negotiation keys.
When keys are loaded from a received PDU, a copy of the received keys block is saved in the keys struct and the name and value pointers point into that saved block. Freeing the keys frees this block.
However, when keys are added to a keys struct to build a set of keys later sent in a PDU, the keys data block pointer is not used and individual key names and values hold allocated strings. When the keys structure was freed, all of these individual key name and value strings were leaked.
Instead, allocate copies of strings for names and values when parsing a set of keys from a received PDU and free all of the individual key name and value strings when deleting a set of keys.
Reviewed by: mav Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D33545
|