gl: fix leaks
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Tue, 8 Apr 2014 14:54:01 +0000 (15:54 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:36 +0000 (19:31 +0000)
As the relevant variables are initialized to 0/NULL, we can loop
over the full range and make sure we free partial allocations
when an error happens partway through initialization.

gst-libs/gst/gl/egl/gsteglimagememory.c

index 90f6219..760f48e 100644 (file)
@@ -556,7 +556,7 @@ mem_error:
   {
     GST_ERROR_OBJECT (GST_CAT_DEFAULT, "Failed to create EGLImage");
 
-    for (i = 0; i < n_mem; i++) {
+    for (i = 0; i < 3; i++) {
       if (client_buffer_tex[i])
         gst_gl_context_del_texture (ctx, (GLuint *) & client_buffer_tex[i]);
       if (mem[i])