virDomainDiskDefFree(virDomainDiskDefPtr def)
{
    if (!def)
        return;

    virObjectUnref(def->src);
    VIR_FREE(def->serial);
    VIR_FREE(def->dst);
    virObjectUnref(def->mirror);
    VIR_FREE(def->wwn);
    VIR_FREE(def->driverName);
    VIR_FREE(def->vendor);
    VIR_FREE(def->product);
    VIR_FREE(def->domain_name);
    VIR_FREE(def->blkdeviotune.group_name);
    VIR_FREE(def->virtio);
    virDomainDeviceInfoClear(&def->info);
    virObjectUnref(def->privateData);

    VIR_FREE(def);
}
virDomainDiskDefFree(virDomainDiskDefPtr def)
{
    if (!def)
        return;

    virObjectUnref(def->src);
    VIR_FREE(def->serial);
    VIR_FREE(def->dst);
    virObjectUnref(def->mirror);
    VIR_FREE(def->wwn);
    VIR_FREE(def->driverName);
    VIR_FREE(def->vendor);
    VIR_FREE(def->product);
    VIR_FREE(def->domain_name);
    VIR_FREE(def->blkdeviotune.group_name);
    VIR_FREE(def->virtio);
    virDomainDeviceInfoClear(&def->info);
    virObjectUnref(def->privateData);

    VIR_FREE(def);
}