OpenGLTutorial icon indicating copy to clipboard operation
OpenGLTutorial copied to clipboard

Memory leak in vertex_buffer.h

Open wediaklup opened this issue 3 years ago • 0 comments

In VertexBuffer constructor a vertex array object and a buffer are created (Ln. 8/Ln. 11) but the destructor only frees the buffer but not the vao.

https://github.com/Pilzschaf/OpenGLTutorial/blob/b4fe9e7404c1fb18bc93f3e0ac8fb4f6edc73f82/vertex_buffer.h#L8

https://github.com/Pilzschaf/OpenGLTutorial/blob/b4fe9e7404c1fb18bc93f3e0ac8fb4f6edc73f82/vertex_buffer.h#L11

https://github.com/Pilzschaf/OpenGLTutorial/blob/b4fe9e7404c1fb18bc93f3e0ac8fb4f6edc73f82/vertex_buffer.h#L27-L29

Inserting glDeleteVertexArrays(1, &vao); into the destructors code solved the problem for me.

wediaklup avatar Jul 21 '22 19:07 wediaklup