[PATCH 1/2] openpty: close slave pty fd on error

Florian Weimer fweimer@redhat.com
Tue Aug 29 09:07:00 GMT 2017


On 08/26/2017 03:44 PM, Christian Brauner wrote:
>   fail:
>    close (master);
> +  if (slave != -1)
> +    close(slave);
>    return -1;

This is inconsistent with how the code frees buf if there is an error:
For buf, the free operation happens before the fail tail.  I think we
should keep this consistent: either free exactly what is needed, or have
a single function exit which checks for initialization and frees what
has been allocated.

Thanks,
Florian



More information about the Libc-alpha mailing list