Fixes for leaks reported by cppcheck.
authorVölgyes Dávid <david.volgyes@gmail.com>
Wed, 6 Jul 2011 14:10:20 +0000 (10:10 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 6 Jul 2011 14:11:04 +0000 (10:11 -0400)
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/platform_x11.c
src/egl/wayland/wayland-drm/wayland-drm.c

index 5680c360f1d3c20110526002befa3b2b17cfafba..35a598ecab855bab63f53c9972c98369933f29ac 100644 (file)
@@ -923,8 +923,10 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
       return EGL_NO_IMAGE_KHR;
    }
 
-   if (!_eglInitImage(&dri2_img->base, disp))
+   if (!_eglInitImage(&dri2_img->base, disp)) {
+      free(dri2_img);
       return EGL_NO_IMAGE_KHR;
+   }
 
    dri2_img->dri_image = 
       dri2_dpy->image->createImageFromRenderbuffer(dri2_ctx->dri_context,
@@ -1335,8 +1337,10 @@ _EGL_MAIN(const char *args)
 
    memset(dri2_drv, 0, sizeof *dri2_drv);
 
-   if (!dri2_load(&dri2_drv->base))
+   if (!dri2_load(&dri2_drv->base)) {
+      free(dri2_drv);
       return NULL;
+   }
 
    _eglInitDriverFallbacks(&dri2_drv->base);
    dri2_drv->base.API.Initialize = dri2_initialize;
index 4e00c958cbdf727e88fc2095608067efe418c778..f27bf176fb6de70775ac578af1fcdb68f932cb68 100644 (file)
@@ -845,6 +845,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
    if (!_eglInitImage(&dri2_img->base, disp)) {
       free(buffers_reply);
       free(geometry_reply);
+      free(dri2_img);
       return EGL_NO_IMAGE_KHR;
    }
 
index 3023cd02b07dd61ddeb18b2e4bfb20970ceecae0..ec96c045143ed356146b03fe6ff4204d4d0318eb 100644 (file)
@@ -104,6 +104,7 @@ drm_create_buffer(struct wl_client *client, struct wl_drm *drm,
                wl_client_post_error(client, &drm->object,
                                     WL_DRM_ERROR_INVALID_VISUAL,
                                     "invalid visual");
+               free(buffer);
                return;
        }