> On Apr 25, 2022, at 5:56 AM, Stefan Hajnoczi <stefa...@redhat.com> wrote:
>
> On Tue, Apr 19, 2022 at 04:44:18PM -0400, Jagannathan Raman wrote:
>> +static void dma_unregister(vfu_ctx_t *vfu_ctx, vfu_dma_info_t *info)
>> +{
>> + VfuObject *o = vfu_get_private(vfu_ctx);
>> + AddressSpace *dma_as = NULL;
>> + MemoryRegion *mr = NULL;
>> + ram_addr_t offset;
>> +
>> + mr = memory_region_from_host(info->vaddr, &offset);
>> + if (!mr) {
>> + return;
>> + }
>> +
>> + dma_as = pci_device_iommu_address_space(o->pci_dev);
>> +
>> + memory_region_del_subregion(dma_as->root, mr);
>> +
>> + object_unparent((OBJECT(mr)));
>
> Where is obj->parent set?
Yeah, it should be object_unref().
Thank you!
--
Jag
>
> If it is not set then this call is a nop and mr is not freed:
>
> void object_unparent(Object *obj)
> {
> if (obj->parent) {
> object_property_del_child(obj->parent, obj);
> }
> }