On Fri, Feb 13, 2009 at 05:56:14PM +0100, Jim Meyering wrote: > "Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote: > ... > > This is not safe in general, because after the 'AssignDef' call, the > > 'def' is now owned by the 'obj'. If you don't set it to NULL immediately > > you have the risk of later error cleanup paths, seeing the non-NULL def > > and free'ing it when they shouldn't. > > > > The virGetNetwork() calls should be changed to call 'obj->def->name' > > instead of just 'def->name'. > > Ok. that's safer, so I've adjusted the first two fixes. > The latter two functions weren't broken, but I've adjusted > the formatting to be consistent with single-stmt-no-curly-braces > convention. In these multiple-1000's-of-line files, every little > bit helps. > > From baf2ec1ee6246f9e472b67d522676b8d41534525 Mon Sep 17 00:00:00 2001 > From: Jim Meyering <meyering@xxxxxxxxxx> > Date: Fri, 13 Feb 2009 16:49:50 +0100 > Subject: [PATCH] test:///default driver: don't dereference NULL "def" > > * src/test.c (testNetworkCreate, testNetworkDefine): Since "def" is > set to NULL immediately after any vir*AssignDef call (to indicate we > no longer own it and to ensure no clean-up path mistakenly frees it), > dereference via net->def->, not def->. ACK, looks fine now. 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 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list