On Tue, 4 Aug 2026 16:33:40 GMT, Roman Marchenko <[email protected]> wrote:

>> modules/javafx.media/src/main/native/gstreamer/plugins/dshowwrapper/Allocator.cpp
>>  line 71:
>> 
>>> 69:     m_pBuffer = NULL;
>>> 70:     if (FAILED(hr))
>>> 71:         return hr;
>> 
>> If `SetGstBuffer` fails, I think you need to release the sample and clear 
>> `*ppBuffer` to avoid leaking sample buffers, since the caller doesn't in the 
>> case of a reported failure. Maybe something like this?
>> 
>> 
>>     if (FAILED(hr)) {
>>         pSample->Release();
>>         *ppBuffer = null;
>>         return hr;
>>     }
>
> @kevinrushforth 
> If so, then I think we need to release the sample after a failed 
> `GetGstBuffer` as well, am I right?
> Like
> 
>         if (GetGstBuffer != NULL)
>             GetGstBuffer(&m_pBuffer, m_lSize, &m_UserData);
> 
>         if (m_pBuffer == NULL)
>         {
>             pSample->Release();
>             *ppBuffer = NULL;
>             return E_FAIL;
>         }

Yes, I think you are right, except that `pSample` hasn't yet been assigned (so 
the assignment of `pSample` would need to be moved up).

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2234#discussion_r3714447887

Reply via email to