From 34d043330b4b8d0f099b3fba5a7e0e6f8ad091ee Mon Sep 17 00:00:00 2001 From: asc Date: Sun, 21 Dec 2014 13:59:04 -0800 Subject: [PATCH] Silence some valgrind complaints --- src/interface.c | 3 ++- src/video/glvideo.c | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/interface.c b/src/interface.c index 8a170991..26c98114 100644 --- a/src/interface.c +++ b/src/interface.c @@ -1353,7 +1353,7 @@ void c_interface_credits() #define SCROLL_LENGTH 58 #define SCROLL_WIDTH (INTERFACE_SCREEN_X+1-(SCROLL_AREA_X*2)) - char credits[SCROLL_LENGTH][SCROLL_WIDTH]= + char credits[SCROLL_LENGTH+1][SCROLL_WIDTH]= //1. 5. 10. 15. 20. 25. 30. 35. 40. 45. 50. 55. 60. 65. 70. 75. 80.", { " ", " An Apple //e Emulator for POSIX Systems! ", @@ -1412,6 +1412,7 @@ void c_interface_credits() " > ROM images used by the emulator are copyright Apple Computer ", " ", " > Disk images are copyright by various third parties ", + " ", " " }; video_setpage( 0 ); diff --git a/src/video/glvideo.c b/src/video/glvideo.c index a0b3e183..1036c8c6 100644 --- a/src/video/glvideo.c +++ b/src/video/glvideo.c @@ -236,15 +236,14 @@ static GLuint _create_VAO(demoModel *model) { } static void _destroy_VAO(GLuint vaoName) { - GLuint index; - GLuint bufName; // Bind the VAO so we can get data from it glBindVertexArray(vaoName); // For every possible attribute set in the VAO - for (index = 0; index < 16; index++) { + for (GLuint index = 0; index < 16; index++) { // Get the VBO set for that attibute + GLuint bufName = 0; glGetVertexAttribiv(index , GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, (GLint*)&bufName); // If there was a VBO set... @@ -255,12 +254,15 @@ static void _destroy_VAO(GLuint vaoName) { } // Get any element array VBO set in the VAO - glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, (GLint*)&bufName); + { + GLuint bufName = 0; + glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, (GLint*)&bufName); - // If there was a element array VBO set in the VAO - if(bufName) { - //...delete the VBO - glDeleteBuffers(1, &bufName); + // If there was a element array VBO set in the VAO + if (bufName) { + //...delete the VBO + glDeleteBuffers(1, &bufName); + } } // Finally, delete the VAO