[Libvirt-cim] [PATCH] VirtualSystemManagementService: Fixing potential null dereferences and leaks

Wayne Xia xiawenc at linux.vnet.ibm.com
Thu Aug 11 05:08:29 UTC 2011


Seems fine, +1

于 2011-8-11 3:53, Eduardo Lima (Etrunko) 写道:
> # HG changeset patch
> # User Eduardo Lima (Etrunko)<eblima at br.ibm.com>
> # Date 1312918075 10800
> # Node ID 8759e60c17c42101118f914215d071138340c70f
> # Parent  0291fb05e93a0cbcbf2b80c894a47d58f7c37d23
> VirtualSystemManagementService: Fixing potential null dereferences and leaks
>
> As reported in https://bugzilla.redhat.com/show_bug.cgi?id=728245
>
> line 1048 - Comparing "path" to null implies that "path" might be null.
> line 1057 - Dereferencing null variable "path".
> line 1088 - Comparing "port" to null implies that "port" might be null.
> line 1094 - Dereferencing null variable "port".
>
> Signed-off-by: Eduardo Lima (Etrunko)<eblima at br.ibm.com>
>
> diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
> --- a/src/Virt_VirtualSystemManagementService.c
> +++ b/src/Virt_VirtualSystemManagementService.c
> @@ -1054,8 +1054,12 @@
>           ret = 1;
>
>    out:
> -        CU_DEBUG("Exiting parse_console_address, ip is %s, port is %s",
> -               *path, *port);
> +        free(tmp_path);
> +        free(tmp_port);
> +
> +        if (path&&  port)
> +                CU_DEBUG("Exiting parse_console_address, ip is %s, port is %s",
> +                       *path, *port);
>
>           return ret;
>   }
> @@ -1091,8 +1095,12 @@
>           ret = 1;
>
>    out:
> -        CU_DEBUG("Exiting parse_vnc_address, ip is %s, port is %s",
> -                *ip, *port);
> +        free(tmp_ip);
> +        free(tmp_port);
> +
> +        if (ip&&  port)
> +                CU_DEBUG("Exiting parse_vnc_address, ip is %s, port is %s",
> +                        *ip, *port);
>
>           return ret;
>   }
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim


-- 
Best Regards

Wayne Xia
mail:xiawenc at linux.vnet.ibm.com
tel:86-010-82450803




More information about the Libvirt-cim mailing list