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

Daniel P. Berrange berrange at redhat.com
Thu Sep 3 10:33:55 UTC 2009


On Thu, Sep 03, 2009 at 11:25:19AM +0200, Jim Meyering wrote:
> This looks like a real bug.
> 
> >From 170af3320e68a0ac2cfe854fba28abe0e4040d2c Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Thu, 3 Sep 2009 11:24:44 +0200
> Subject: [PATCH] openvz_conf.c: don't use undefined local, "net"
> 
> * src/openvz_conf.c (openvzReadNetworkConf): Upon openvzRead... failure,
> simply return -1, rather than "goto error;" where an uninitialized
> "net" could be dereferenced.
> ---
>  src/openvz_conf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

For this one I think it'd be preferrable to just change the variable
declaration of 'net' to be initialized to NULL, since that'd be offer
some protection against later refactoring introducing similar problemn

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list