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

Re: [libvirt] [PATCH] openvz_conf.c: don't use undefined local, "net"



On Thu, Sep 03, 2009 at 12:38:43PM +0200, Jim Meyering wrote:
> Jim Meyering wrote:
> When I reran the tool, there was still a potential NULL-deref,
> so I propose to do this instead:
> 
> >From d120f7693f1ae0e213bd9e8b244968b49dfe1427 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Thu, 3 Sep 2009 12:33:11 +0200
> Subject: [PATCH] openvz_conf.c: don't use undefined local, "net"
> 
> * src/openvz_conf.c (openvzReadNetworkConf): Initialize "net".
> Otherwise, upon openvzRead... failure, we would "goto error;"
> where an uninitialized "net" could be dereferenced.
> ---
>  src/openvz_conf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/openvz_conf.c b/src/openvz_conf.c
> index a172fe3..41c6684 100644
> --- a/src/openvz_conf.c
> +++ b/src/openvz_conf.c
> @@ -183,7 +183,7 @@ openvzReadNetworkConf(virConnectPtr conn,
>                        virDomainDefPtr def,
>                        int veid) {
>      int ret;
> -    virDomainNetDefPtr net;
> +    virDomainNetDefPtr net = NULL;
>      char temp[4096];
>      char *token, *saveptr = NULL;
> 

  Looks better to me too, ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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