mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-24 15:27:41 +08:00
fix(vectornav): free temporary buffer in libvnc VnSearcher_discardData
The swap buffer in VnSearcher_discardData was malloc'd but never freed, leaking on every call. Reported by Martin Strunz. No VnSearcher_* symbol is referenced by the driver today, so the linker drops searcher.c entirely and no shipped firmware is affected. Fixed anyway so the leak cannot go live if the port autodetect API is ever used. Upstream vnproglib is frozen with no public repository, so the fix is carried in the vendored copy. Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
@@ -84,6 +84,7 @@ void VnSearcher_discardData(char inputData[], size_t dataLength, size_t discardL
|
||||
memset(inputData, 0, dataLength);
|
||||
/*memcpy_s(inputData, tmpSize, tmp, tmpSize);*/
|
||||
memcpy(inputData, tmp, tmpSize);
|
||||
free(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user