coregl_fastpath_gl: Fix svace issues - unreachable, null deref 66/139766/2
authorHoyub Lee <hoyub.lee@samsung.com>
Thu, 20 Jul 2017 05:37:02 +0000 (14:37 +0900)
committerHoyub Lee <hoyub.lee@samsung.com>
Thu, 20 Jul 2017 10:48:03 +0000 (19:48 +0900)
Change-Id: Ie7110d8b14d2c9bf14caa07f9a8d4f80b6824f9f
Signed-off-by: Hoyub Lee <hoyub.lee@samsung.com>
src/modules/fastpath/coregl_fastpath_gl.c

index 6a1ac02..2e61bbd 100644 (file)
@@ -647,6 +647,7 @@ fastpath_glDeleteTextures(GLsizei n, const GLuint *textures)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -1171,6 +1172,7 @@ fastpath_glDeleteBuffers(GLsizei n, const GLuint *buffers)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -1462,6 +1464,7 @@ fastpath_glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -1660,6 +1663,7 @@ fastpath_glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -1793,6 +1797,7 @@ fastpath_glShaderBinary(GLsizei n, const GLuint *shaders, GLenum binaryformat,
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
 
        for (i = 0; i < n; i++) {
                if (shaders[i] == 0) continue;
@@ -3380,14 +3385,11 @@ fastpath_glDisable(GLenum cap)
                _set_gl_error(GL_INVALID_ENUM);
                break;
        }
-       goto finish;
-
-
-#undef STATE_PROC
 
        goto finish;
 
 finish:
+#undef STATE_PROC
        _COREGL_FASTPATH_FUNC_END();
 }
 
@@ -4582,6 +4584,7 @@ fastpath_glDeleteQueries(GLsizei n, const GLuint *ids)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -4875,6 +4878,7 @@ fastpath_glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -5140,6 +5144,7 @@ fastpath_glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -5759,6 +5764,7 @@ fastpath_glDeleteSamplers(GLsizei n, const GLuint *samplers)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -6133,6 +6139,7 @@ fastpath_glDeleteProgramPipelines(GLsizei n, GLuint const *pipelines)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -7510,6 +7517,7 @@ fastpath_glDeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -7584,6 +7592,7 @@ fastpath_glDeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;
 
@@ -7999,6 +8008,7 @@ fastpath_glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
 
        for (i = 0; i < n; i++) {
                GLuint real_obj;
@@ -8424,6 +8434,7 @@ fastpath_glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
        AST(current_ctx->ostate.shared != NULL);
 
        objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       if (objid_array == NULL) goto finish;
        {
                int real_n = 0;