On Tue, May 27, 2014 at 09:40:02AM +0800, arei.gong...@huawei.com wrote:
> From: Gonglei <arei.gong...@huawei.com>
> 
> Signed-off-by: Gonglei <arei.gong...@huawei.com>
> ---
>  qemu-bridge-helper.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/qemu-bridge-helper.c b/qemu-bridge-helper.c
> index 6a0974e..dce5abc 100644
> --- a/qemu-bridge-helper.c
> +++ b/qemu-bridge-helper.c
> @@ -436,7 +436,12 @@ int main(int argc, char **argv)
>      /* profit! */
>  
>  cleanup:
> -
> +    if (fd >= 0) {
> +        close(fd);
> +    }
> +    if (ctlfd >= 0) {
> +        close(ctlfd);
> +    }

fd and ctlfd are uninitialized:

  int fd, ctlfd, unixfd = -1;

This patch introduces a read of uninitialized memory and could close a
random file descriptor.

There wasn't a real leak since this is the main() function and the
kernel frees resources when the process terminates.

Please either drop this patch or fix it carefully.

Reply via email to