[libvirt] [PATCH] conf: Actually make virDomainChrSourceDef an object

John Ferlan jferlan at redhat.com
Thu Apr 12 11:08:17 UTC 2018



On 04/12/2018 04:44 AM, Erik Skultety wrote:
> On Thu, Apr 12, 2018 at 09:14:50AM +0200, Michal Privoznik wrote:
>> In 2ada9ef1465f we've tried to turn virDomainChrSourceDef into
>> virObject. Well, this requires 'virObject' member to be stored on
>> the first position of the struct. This adjustment is missing in
>> the original commit leading to all sorts of funny memleaks and
>> data corruptions.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>  src/conf/domain_conf.h | 2 ++
>>  1 file changed, 2 insertions(+)
>>

Doh!  Thanks....  I guess not only do we need a way to detect that we're
using VIR_ALLOC on an object (as Eric pointed out in my original
patches), but we really should detect when we use virObjectNew without
the virObject parent. For some reason, I have a recollection of altering
changes during my meanderings through virObject code in order to point
out more directly some misuses, but it was rejected. Although I cannot
recall if this particular instance of not having virObject parent was
addressed...

Tks -

John

>> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
>> index 89a7131fdb..1426f115ed 100644
>> --- a/src/conf/domain_conf.h
>> +++ b/src/conf/domain_conf.h
>> @@ -57,6 +57,7 @@
>>  # include "virtypedparam.h"
>>  # include "virsavecookie.h"
>>  # include "virresctrl.h"
>> +# include "virobject.h"
> 
> syntax-check fails ^here because the header is already included on line 49
> 
> With that fixed:
> Reviewed-by: Erik Skultety <eskultet at redhat.com>
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 




More information about the libvir-list mailing list