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>
master
Rafał Miłecki 7 years ago
parent 70837168ef
commit 36a92274a8
  1. 3
      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) { 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;
} }

Loading…
Cancel
Save