Re: [PATCH linux vdagent 2/2] Avoid leaking udscs file descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> This is a  finding from coverity. In practice it has very little impact

maybe Coverity (with capital) ?

> since returning NULL from this function results in the process existing
> with an error.
> 
> Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
> ---
>  src/udscs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/udscs.c b/src/udscs.c
> index 64f0307..6e73015 100644
> --- a/src/udscs.c
> +++ b/src/udscs.c
> @@ -450,12 +450,14 @@ struct udscs_server *udscs_create_server(const char
> *socketname,
>      c = bind(fd, (struct sockaddr *)&address, sizeof(address));
>      if (c != 0) {
>          syslog(LOG_ERR, "bind %s: %m", socketname);
> +        close(fd);
>          return NULL;
>      }
>  
>      c = listen(fd, 5);
>      if (c != 0) {
>          syslog(LOG_ERR, "listen: %m");
> +        close(fd);
>          return NULL;
>      }
>  

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

Note that there are 2 other similar paths in udscs_create_server_for_fd that does
not close the file descriptor and return NULL.

I don't consider this patch a 2/2, is quite independent.

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]