summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@intel.com>2013-11-19 15:16:57 +0800
committerEric Anholt <eric@anholt.net>2013-12-18 11:23:54 -0800
commit06ba3fdfd6162a64c149ea6fda85f9f56d7f3c31 (patch)
treeff99ddc78629c56834cc01dc64394f9d14df2c27
parenta5321ea431376feca2dcd55cf04925dc492270fc (diff)
Fixed some compilation warning/error or error checking.
There is one compilation error ,cast int to pointer, when built without libgbm, reported by Gaetan Nadon. And some error checking after memory allocation, reported by Seth Arnold. There are still some similar issues in the largepixmap implementation. They are relatively more complicate due to the heavy usage of RegionXXX APIs which may allocate implicitly. Will fix them in the future. Signed-off-by: Zhigang Gong <zhigang.gong@intel.com> Tested-by: Gaetan Nadon <memsize@videotron.ca>
-rw-r--r--glamor/glamor_core.c13
-rw-r--r--glamor/glamor_egl.c4
2 files changed, 11 insertions, 6 deletions
diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c
index 22065bc64..eb1a08d43 100644
--- a/glamor/glamor_core.c
+++ b/glamor/glamor_core.c
@@ -68,11 +68,14 @@ glamor_compile_glsl_prog(glamor_gl_dispatch * dispatch, GLenum type,
dispatch->glGetShaderiv(prog, GL_INFO_LOG_LENGTH, &size);
info = malloc(size);
-
- dispatch->glGetShaderInfoLog(prog, size, NULL, info);
- ErrorF("Failed to compile %s: %s\n",
- type == GL_FRAGMENT_SHADER ? "FS" : "VS", info);
- ErrorF("Program source:\n%s", source);
+ if (info) {
+ dispatch->glGetShaderInfoLog(prog, size, NULL, info);
+ ErrorF("Failed to compile %s: %s\n",
+ type == GL_FRAGMENT_SHADER ? "FS" : "VS", info);
+ ErrorF("Program source:\n%s", source);
+ free(info);
+ } else
+ ErrorF("Failed to get shader compilation info.\n");
FatalError("GLSL compile failure\n");
}
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 50b764b6a..13b7f44ec 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -500,6 +500,8 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
glamor_identify(0);
glamor_egl = calloc(sizeof(*glamor_egl), 1);
+ if (glamor_egl == NULL)
+ return FALSE;
if (xf86GlamorEGLPrivateIndex == -1)
xf86GlamorEGLPrivateIndex =
xf86AllocateScrnInfoPrivateIndex();
@@ -514,7 +516,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
}
glamor_egl->display = eglGetDisplay(glamor_egl->gbm);
#else
- glamor_egl->display = eglGetDisplay((EGLNativeDisplayType)fd);
+ glamor_egl->display = eglGetDisplay((EGLNativeDisplayType)(intptr_t)fd);
#endif
glamor_egl->has_gem = glamor_egl_check_has_gem(fd);