[libvirt] [PATCH] conf: Allocate structure for 'perf' events in virDomainDefNew

Peter Krempa pkrempa at redhat.com
Wed Jun 29 06:23:42 UTC 2016


On Wed, Jun 29, 2016 at 08:07:29 +0200, Ján Tomko wrote:
> On Tue, Jun 28, 2016 at 02:43:59PM +0200, Peter Krempa wrote:
> >Some code paths already assume that it is allocated since it was always
> >allocated by virDomainPerfDefParseXML. Move allocation to
> 
> Shouldn't we rather fix those code paths?

Having all the accessors deal with this lead to the crash in the first
place.

Additionally accessors will need to deal with that oo.

> virDomainDefNew would get ridiculously long if we started assuming this
> for every optional XML element.

Isn't that the purpose of the allocation helper?

Additionally most structs holding additional data are directly member of
struct _virDomainDef. I'll make this too and get rid of the allocation
completely if you think it's better that way.




More information about the libvir-list mailing list