From 0d9d53dd15194d607f81a82db97403c37fb2f126 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Sun, 24 Jul 2016 15:39:45 +0300 Subject: [PATCH] onewire_parser: Fix memory leak when retrying OWNET_read() If it happens that read fails for any reason and the code retries reading, the previous read buffer is not freed properly. This causes a minor (26 byte) memory leak on each retry. Add a free() call to avoid the leak. Signed-off-by: Timo Kokkonen --- onewire_parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/onewire_parser.c b/onewire_parser.c index eb2ccd2..96bd5b2 100644 --- a/onewire_parser.c +++ b/onewire_parser.c @@ -148,6 +148,7 @@ undefined: goto undefined; } retries++; + free(tmp); } /* The data from OWNET_read appears to not be NULL terminated */ -- 2.44.0