If allocating an XvShmImage generates an X error, but
still returns some allocated memory, make sure to free it
so it doesn't leak.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3100>
context->xv_port_id, im_format, NULL, padded_width, padded_height,
&mem->SHMInfo);
if (!mem->xvimage || error_caught) {
+
+ /* If the memory was allocated, drop it */
+ if (mem->xvimage) {
+ XFree (mem->xvimage);
+ mem->xvimage = NULL;
+ }
+
g_mutex_unlock (&context->lock);
/* Reset error flag */