mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virObjectEventNew: Use virObjectUnref() to free virObjectEvent
While no leak was observed yet, there might be one if virObjectEventClass is ever derived from another class. Because in that case plain VIR_FREE() will not call dispose() from parent classes possibly leaking some memory. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
b3df357da6
commit
b660238eb1
@ -649,13 +649,9 @@ virObjectEventNew(virClassPtr klass,
|
||||
event->eventID = eventID;
|
||||
event->remoteID = -1;
|
||||
|
||||
if (VIR_STRDUP(event->meta.name, name) < 0) {
|
||||
VIR_FREE(event);
|
||||
return NULL;
|
||||
}
|
||||
if (VIR_STRDUP(event->meta.key, key) < 0) {
|
||||
VIR_FREE(event->meta.name);
|
||||
VIR_FREE(event);
|
||||
if (VIR_STRDUP(event->meta.name, name) < 0 ||
|
||||
VIR_STRDUP(event->meta.key, key) < 0) {
|
||||
virObjectUnref(event);
|
||||
return NULL;
|
||||
}
|
||||
event->meta.id = id;
|
||||
|
Loading…
Reference in New Issue
Block a user