mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-13 15:20:31 +01:00
mesa: fix memory leak when generating mipmaps for compressed textures
This commit is contained in:
parent
0574954238
commit
167ffa9e03
1 changed files with 10 additions and 6 deletions
|
|
@ -1510,7 +1510,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||
|
||||
/* Find convertFormat - the format that do_row() will process */
|
||||
if (srcImage->IsCompressed) {
|
||||
/* setup for compressed textures */
|
||||
/* setup for compressed textures - need to allocate temporary
|
||||
* image buffers to hold uncompressed images.
|
||||
*/
|
||||
GLuint row;
|
||||
GLint components, size;
|
||||
GLchan *dst;
|
||||
|
|
@ -1587,11 +1589,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||
&dstWidth, &dstHeight, &dstDepth);
|
||||
if (!nextLevel) {
|
||||
/* all done */
|
||||
if (srcImage->IsCompressed) {
|
||||
_mesa_free((void *) srcData);
|
||||
_mesa_free(dstData);
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
/* get dest gl_texture_image */
|
||||
|
|
@ -1682,6 +1680,12 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||
}
|
||||
|
||||
} /* loop over mipmap levels */
|
||||
|
||||
if (srcImage->IsCompressed) {
|
||||
/* free uncompressed image buffers */
|
||||
_mesa_free((void *) srcData);
|
||||
_mesa_free(dstData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue