+GpStatus terminate_encoder_wic(IWICBitmapEncoder *encoder) +{
- HRESULT hr = IWICBitmapEncoder_Commit(encoder);
- IWICBitmapEncoder_Release(encoder);
- return hresult_to_status(hr);
+}
I don't like having the Release call separated from clearing or freeing the stored reference to the interface. I think we're likely to miss a use-after-free this way.
I'd suggest either making this function take a GpImage* so we can clear the reference, or moving the Release call out of it.