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>
owl
Rafał Miłecki 2017-11-16 10:14:30 +01:00
parent 70837168ef
commit 36a92274a8
1 changed files with 3 additions and 0 deletions

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) {
fprintf(stderr, "Couldn't write %zu B to %s\n", length, trx_path);
free(buf);
return -EIO;
}
free(buf);
return length;
}