libkms: fix memory leak in error path
authorMaxime Villard <rustyBSD@gmx.fr>
Wed, 2 Jan 2013 15:55:50 +0000 (10:55 -0500)
committerJerome Glisse <jglisse@redhat.com>
Wed, 2 Jan 2013 15:55:50 +0000 (10:55 -0500)
Signed-off-by: Maxime Villard <rustyBSD@gmx.fr>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
libkms/intel.c
libkms/nouveau.c

index 8b8249b1815f68fe63c64da8e8ba6c3fb6050feb..abae452574b86c8fb2e500fdd51d066cb9d9ebdc 100644 (file)
@@ -101,6 +101,7 @@ intel_bo_create(struct kms_driver *kms,
                pitch = (pitch + 512 - 1) & ~(512 - 1);
                size = pitch * ((height + 4 - 1) & ~(4 - 1));
        } else {
+               free(bo);
                return -EINVAL;
        }
 
index 0e24a155f857fe9d950be5fc8640620df2903bf4..608092f586d1b9dc3be7434e0f94dadf640abe3a 100644 (file)
@@ -102,6 +102,7 @@ nouveau_bo_create(struct kms_driver *kms,
                pitch = (pitch + 512 - 1) & ~(512 - 1);
                size = pitch * height;
        } else {
+               free(bo);
                return -EINVAL;
        }