On Thu, 2017-11-16 at 10:15 +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <ra...@milecki.pl>
> 
> A "free" call was missing after allocating a buffer.
> 
> Signed-off-by: Rafał Miłecki <ra...@milecki.pl>
> ---
>  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 1c3ffd915b..ac39fefc06 100644
> --- a/package/utils/otrx/src/otrx.c
> +++ b/package/utils/otrx/src/otrx.c
> @@ -266,9 +266,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);
alternatively, could do

unsigned int l = fwrite(buf, 1, length, trx);
free(buf);
if (l != length) {
 ...

no real difference.
> +
>       return length;
>  }
>  

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to