mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-24 18:20:11 +01:00
tests/libkms-test-plane: fix possbile memory leak
The pointer p aquired with drmModeGetPlane() is not free in error path. Fix possible memory leak by calling drmModeFreePlane() in the error path. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
This commit is contained in:
parent
357ef59882
commit
6a7d1329db
1 changed files with 3 additions and 1 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue