otrx: fix memory leak in otrx_create_append_zeros

A "free" call was missing after allocating a buffer.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
Rafał Miłecki 2017-11-16 10:14:30 +01:00
parent 70837168ef
commit 36a92274a8

View file

@ -264,9 +264,12 @@ static ssize_t otrx_create_append_zeros(FILE *trx, size_t length) {
if (fwrite(buf, 1, length, trx) != length) { if (fwrite(buf, 1, length, trx) != length) {
fprintf(stderr, "Couldn't write %zu B to %s\n", length, trx_path); fprintf(stderr, "Couldn't write %zu B to %s\n", length, trx_path);
free(buf);
return -EIO; return -EIO;
} }
free(buf);
return length; return length;
} }