summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeung-Woo Kim <sw0312.kim@samsung.com>2017-03-09 18:41:48 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2017-03-09 18:41:51 +0900
commit9b8ed9dc473636293358a2da479bc29bb9d6bed8 (patch)
treefa68972369bcfd0198f046839e04f43a164f20d9
parente621f48fe4cb32d8cc8bf1964e62ed66c0a156f5 (diff)
downloadlibdrm-9b8ed9dc473636293358a2da479bc29bb9d6bed8.tar.gz
libdrm-9b8ed9dc473636293358a2da479bc29bb9d6bed8.tar.bz2
libdrm-9b8ed9dc473636293358a2da479bc29bb9d6bed8.zip
tests/exynos: fix memory issues in g2d test
This patch fixes memory issues including NULL deference and leak in g2d test. Change-Id: I2b554cae51f2a14b88100c8b9fac3239ac737bae Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
-rw-r--r--tests/exynos/exynos_fimg2d_test.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c
index 797fb6eb..2177e084 100644
--- a/tests/exynos/exynos_fimg2d_test.c
+++ b/tests/exynos/exynos_fimg2d_test.c
@@ -59,7 +59,6 @@ static void connector_find_mode(int fd, struct connector *c,
if (!connector) {
fprintf(stderr, "could not get connector %i: %s\n",
resources->connectors[i], strerror(errno));
- drmModeFreeConnector(connector);
continue;
}
@@ -98,7 +97,6 @@ static void connector_find_mode(int fd, struct connector *c,
if (!c->encoder) {
fprintf(stderr, "could not get encoder %i: %s\n",
resources->encoders[i], strerror(errno));
- drmModeFreeEncoder(c->encoder);
continue;
}
@@ -264,7 +262,8 @@ static int g2d_copy_test(struct exynos_device *dev, struct exynos_bo *src,
userptr = (unsigned long)malloc(size);
if (!userptr) {
fprintf(stderr, "failed to allocate userptr.\n");
- return -EFAULT;
+ ret = -EFAULT;
+ goto fail;
}
src_img.user_ptr[0].userptr = userptr;
@@ -469,7 +468,8 @@ static int g2d_copy_with_scale_test(struct exynos_device *dev,
userptr = (unsigned long)malloc(size);
if (!userptr) {
fprintf(stderr, "failed to allocate userptr.\n");
- return -EFAULT;
+ ret = -EFAULT;
+ goto fail;
}
src_img.user_ptr[0].userptr = userptr;
@@ -557,7 +557,8 @@ static int g2d_blend_test(struct exynos_device *dev,
userptr = (unsigned long)malloc(size);
if (!userptr) {
fprintf(stderr, "failed to allocate userptr.\n");
- return -EFAULT;
+ ret = -EFAULT;
+ goto fail;
}
src_img.user_ptr[0].userptr = userptr;
@@ -755,7 +756,7 @@ int main(int argc, char **argv)
dev = exynos_device_create(fd);
if (!dev) {
- drmClose(dev->fd);
+ drmClose(fd);
return -EFAULT;
}