<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 12, 2016 at 8:45 PM, Aaryaman Vasishta <span dir="ltr"><<a href="mailto:jem456.vasishta@gmail.com" target="_blank">jem456.vasishta@gmail.com</a>></span> wrote<span></span><br><span></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>
> +static HRESULT WINAPI d3drm_frame1_AddChild(IDirect3DRMFrame *iface, IDirect3DRMFrame *child)<br>
> +{<br>
> +    struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);<br>
> +    IDirect3DRMFrame3 *child3;<br>
> +    HRESULT hr;<br>
> +<br>
> +    TRACE("iface %p, child %p.\n", iface, child);<br>
> +<br>
> +    if (!child)<br>
> +        return D3DRMERR_BADOBJECT;<br>
> +    hr = IDirect3DRMFrame_QueryInterface(child, &IID_IDirect3DRMFrame3, (void **)&child3);<br>
> +    if (hr != S_OK)<br>
> +        return D3DRMERR_BADOBJECT;<br>
> +    IDirect3DRMFrame_Release(child);<br>
> +<br>
> +    return IDirect3DRMFrame3_AddChild(&frame->IDirect3DRMFrame3_iface, child3);<br>
> +}<br>
</span>This doesn't seem right. Right now you're releasing a reference you don't own (child's frame1) and leak one (child's frame3). Is there a reason why you're using QueryInterface instead of accessing child->IDirect3DRMFrame3_iface? <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
If you stick to QI I think this should be more like this (error checking excluded):<br>
QI(child, IID_child3, &child3);<br>
hr = Frame3_AddChild(frame, child3);<br>
IDirect3DRMFrame3_Release(child3);<br>
<br>
d3drm_frame2_AddChild has the same problem, this is where your code seems to come from.<br></blockquote></span><div>I didn't write this (copied from version 3), though your approach does 
make sense. I could fix this in a separate patch if needed. <br></div><span class=""></span><div><div><div><div class="gmail_extra"><br></div></div></div></div></div></blockquote><div>I think the reasoning behind that approach could be that all versions share the same refcount, so it really doesn't matter which version is released, as long as the recount is maintained.  Also the refcount tests for AddChild are present in test_Frame, so the leak is intentional.<br><br></div><div>Cheers,<br></div><div>Aaryaman <br></div></div><br></div></div>