From 2f051a202c83560b6a78a2a50b7c935c44f09639 Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Wed, 29 Mar 2017 16:38:13 -0700 Subject: [PATCH] ldt0028: Removed new for example array Not necessary in C++. This was getting flagged as a memory leak in the examples. Not a big deal, but can be done differently. Signed-off-by: Noel Eck --- examples/c++/ldt0028.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/c++/ldt0028.cxx b/examples/c++/ldt0028.cxx index baaac118..d0b40937 100644 --- a/examples/c++/ldt0028.cxx +++ b/examples/c++/ldt0028.cxx @@ -44,7 +44,7 @@ main(int argc, char **argv) std::cout << "For the next " << NUMBER_OF_SECONDS << " seconds, " << SAMPLES_PER_SECOND << " samples will be taken every second." << std::endl << std::endl; - uint16_t* buffer = new uint16_t[NUMBER_OF_SECONDS * SAMPLES_PER_SECOND]; + uint16_t buffer[NUMBER_OF_SECONDS * SAMPLES_PER_SECOND]; for (int i=0; i < NUMBER_OF_SECONDS * SAMPLES_PER_SECOND; i++) { buffer[i] = (uint16_t) sensor->getSample(); usleep(MICROSECONDS_PER_SECOND / SAMPLES_PER_SECOND);