From: Rafał Miłecki Date: Thu, 16 Nov 2017 09:14:30 +0000 (+0100) Subject: otrx: fix memory leak in otrx_create_append_zeros X-Git-Tag: v18.06.0-rc1~1706 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=36a92274a80056d224288721fa7c71b5ad9680b5;p=oweals%2Fopenwrt.git otrx: fix memory leak in otrx_create_append_zeros A "free" call was missing after allocating a buffer. Signed-off-by: Rafał Miłecki --- diff --git a/package/utils/otrx/src/otrx.c b/package/utils/otrx/src/otrx.c index 0d99cd39e3..223e032f2b 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; }