OSDN Git Service

[BSD] Fix lock leak in drm_update_draw malloc failure path.
authorOwain Ainsworth <oga@stephanie.cybernetseraph.org>
Tue, 27 May 2008 22:11:25 +0000 (15:11 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 27 May 2008 22:11:25 +0000 (15:11 -0700)
bsd-core/drm_drawable.c

index 7c44352..268b956 100644 (file)
@@ -136,8 +136,10 @@ int drm_update_draw(struct drm_device *dev, void *data,
                if (info->rects == NULL) {
                        info->rects = drm_alloc(sizeof(*info->rects) *
                            update->num, DRM_MEM_DRAWABLE);
-                       if (info->rects == NULL)
+                       if (info->rects == NULL) {
+                               DRM_SPINUNLOCK(&dev->drw_lock);
                                return ENOMEM;
+                       }
                        info->num_rects = update->num;
                }
                /* For some reason the pointer arg is unsigned long long. */