diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-12-02 14:04:18 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-12-04 21:42:43 -0500 |
commit | 671fac7c4526b61143f860c4800047c3f7ff6fc4 (patch) | |
tree | 026b4a16156c11ecfe011a8324317290c029e832 /include | |
parent | e8f6cf14c97ef4221a78094c2fad4cdd06b7d97e (diff) | |
download | gdb-671fac7c4526b61143f860c4800047c3f7ff6fc4.zip gdb-671fac7c4526b61143f860c4800047c3f7ff6fc4.tar.gz gdb-671fac7c4526b61143f860c4800047c3f7ff6fc4.tar.bz2 |
gdbsupport: fix memory leak in create_file_handler when re-using file handler
ASan made me notice a memory leak, where the memory tied to the file
handle name string wasn't freed. When register a file handler with an
fd that is already registered, we re-use the file_handler object, so we
ended up creating a new std::string object and overwriting the
file_handler::name pointer, without free-ing the old std::string.
Fix this by allocating file_handler with new, deleting it with
delete, and making file_handler::name not a pointer.
Change-Id: Ie304cc78ab5ae5dfad9a1366e9890c09de651f43
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions