diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c index 0f649f4ab43..4b7b85db708 100644 --- a/src/mesa/state_tracker/st_cb_eglimage.c +++ b/src/mesa/state_tracker/st_cb_eglimage.c @@ -96,6 +96,7 @@ st_egl_image_get_surface(struct gl_context *ctx, GLeglImageOES image_handle, if (!is_format_supported(screen, stimg.format, stimg.texture->nr_samples, usage)) { /* unable to specify a texture object using the specified EGL image */ + pipe_resource_reference(&stimg.texture, NULL); _mesa_error(ctx, GL_INVALID_OPERATION, "%s(format not supported)", error); return NULL; }