From: Timo Kokkonen Date: Sun, 24 Jul 2016 12:39:45 +0000 (+0300) Subject: onewire_parser: Fix memory leak when retrying OWNET_read() X-Git-Url: http://git.itanic.dy.fi/?p=rrdd;a=commitdiff_plain;h=0d9d53dd15194d607f81a82db97403c37fb2f126 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 --- 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 */