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:
Ramon Roche
2026-07-18 16:55:15 -04:00
committed by Beat Küng
parent d015b596b9
commit e312313f77

View File

@@ -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);
}
}