diff options
author | Zhigang Gong <zhigang.gong@intel.com> | 2013-11-19 15:16:57 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2013-11-20 10:28:53 +0800 |
commit | 71e7168d7af236e43cea0658b612129bb1d46ff7 (patch) | |
tree | 45ed49e89703149a2df6147e1bbf1e911566b756 | |
parent | b418b13126108fe83628825b5015f348914ad5f5 (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-- | src/glamor_core.c | 13 | ||||
-rw-r--r-- | src/glamor_egl.c | 4 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/glamor_core.c b/src/glamor_core.c index 22065bc..eb1a08d 100644 --- a/src/glamor_core.c +++ b/src/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/src/glamor_egl.c b/src/glamor_egl.c index 50b764b..13b7f44 100644 --- a/src/glamor_egl.c +++ b/src/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); |