OSDN Git Service

tests/libkms-test-plane: fix possbile memory leak
[android-x86/external-libdrm.git] / tests / kms / libkms-test-plane.c
index 6c40a3c..4cb2737 100644 (file)
@@ -55,8 +55,10 @@ static int kms_plane_probe(struct kms_plane *plane)
        }
 
        plane->formats = calloc(p->count_formats, sizeof(uint32_t));
-       if (!plane->formats)
+       if (!plane->formats) {
+               drmModeFreePlane(p);
                return -ENOMEM;
+       }
 
        for (i = 0; i < p->count_formats; i++)
                plane->formats[i] = p->formats[i];