From 36a92274a80056d224288721fa7c71b5ad9680b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 16 Nov 2017 10:14:30 +0100 Subject: otrx: fix memory leak in otrx_create_append_zeros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A "free" call was missing after allocating a buffer. Signed-off-by: Rafał Miłecki --- package/utils/otrx/src/otrx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/utils/otrx/src/otrx.c b/package/utils/otrx/src/otrx.c index 0d99cd3..223e032 100644 --- a/package/utils/otrx/src/otrx.c +++ b/package/utils/otrx/src/otrx.c @@ -264,9 +264,12 @@ static ssize_t otrx_create_append_zeros(FILE *trx, size_t length) { if (fwrite(buf, 1, length, trx) != length) { fprintf(stderr, "Couldn't write %zu B to %s\n", length, trx_path); + free(buf); return -EIO; } + free(buf); + return length; } -- cgit v1.1