gl_common: zero initialize new image data in gl_image_decouple

Previously some fiedls of gl_texture allocated in gl_image_decouple are
not initialized.

This commit replaces cmalloc with ccalloc to make sure the allocated
gl_texture is zero initialized.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-03-15 19:53:50 +00:00
parent 5d7ff7101e
commit 0eca07d400
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 1 additions and 1 deletions

View File

@ -1302,7 +1302,7 @@ static inline void gl_image_decouple(backend_t *base, struct gl_image *img) {
} }
struct gl_data *gl = (void *)base; struct gl_data *gl = (void *)base;
auto new_tex = cmalloc(struct gl_texture); auto new_tex = ccalloc(1, struct gl_texture);
glGenTextures(1, &new_tex->texture); glGenTextures(1, &new_tex->texture);
glBindTexture(GL_TEXTURE_2D, new_tex->texture); glBindTexture(GL_TEXTURE_2D, new_tex->texture);