Commit 32e0370e authored by Inki Dae's avatar Inki Dae Committed by Eric Engestrom
Browse files

tests: fix memory leak issue



Fixed memory leak issue to drmModeRes and drmModePlaneRes objects.

These objects were allocated by drmModeGetResources and
drmModeGetPlaneResources functions but not freed properly.

So this patch frees them by calling drmModeFreeResources
drmModeFreePlaneResources functions at failure case.
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
Reviewed-by: Eric Engestrom's avatarEric Engestrom <eric.engestrom@imgtec.com>
parent ed07718a
......@@ -67,7 +67,7 @@ static void kms_device_probe_screens(struct kms_device *device)
device->screens = calloc(res->count_connectors, sizeof(screen));
if (!device->screens)
return;
goto err_free_resources;
for (i = 0; i < res->count_connectors; i++) {
unsigned int *count;
......@@ -97,6 +97,7 @@ static void kms_device_probe_screens(struct kms_device *device)
device->num_screens++;
}
err_free_resources:
drmModeFreeResources(res);
}
......@@ -112,7 +113,7 @@ static void kms_device_probe_crtcs(struct kms_device *device)
device->crtcs = calloc(res->count_crtcs, sizeof(crtc));
if (!device->crtcs)
return;
goto err_free_resources;
for (i = 0; i < res->count_crtcs; i++) {
crtc = kms_crtc_create(device, res->crtcs[i]);
......@@ -123,6 +124,7 @@ static void kms_device_probe_crtcs(struct kms_device *device)
device->num_crtcs++;
}
err_free_resources:
drmModeFreeResources(res);
}
......@@ -138,7 +140,7 @@ static void kms_device_probe_planes(struct kms_device *device)
device->planes = calloc(res->count_planes, sizeof(plane));
if (!device->planes)
return;
goto err_free_resources;
for (i = 0; i < res->count_planes; i++) {
plane = kms_plane_create(device, res->planes[i]);
......@@ -149,6 +151,7 @@ static void kms_device_probe_planes(struct kms_device *device)
device->num_planes++;
}
err_free_resources:
drmModeFreePlaneResources(res);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment