From 0eca07d400935d56aa0c7b2eb937df1130548d9d Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 15 Mar 2020 19:53:50 +0000 Subject: [PATCH] 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 --- src/backend/gl/gl_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index 3029b0c..b23c8f6 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -1302,7 +1302,7 @@ static inline void gl_image_decouple(backend_t *base, struct gl_image *img) { } 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); glBindTexture(GL_TEXTURE_2D, new_tex->texture);