Skip to content

Fix memory leak in SerialCom

Karol Krizka requested to merge serialcomleak into devel

The temporary char array pointer used to read from the file descriptor before converting to a string was never deleted. This fixes the memory leak (and speeds up the code) by making the temporary array a member of SerialCom and not a pointer.

Also updated the description of SerialCom::read(std::string&) to reflect how it is being used in all of the code. The maximum read length is not taken from the buffer string, but was always taken to be MAX_READ.

Merge request reports