[Mesa-dev] [PATCH] swr: Remove unnecessary memset call

Vlad Golovkin vlad.golovkin.mail at gmail.com
Fri Apr 13 01:49:51 UTC 2018


Zeroing memory after calloc is not necessary. This also allows to avoid
possible crash when allocation fails, because memset is called before
checking screen for NULL.
---
 src/gallium/drivers/swr/swr_screen.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
index 880a177c39..4e43ac55fb 100644
--- a/src/gallium/drivers/swr/swr_screen.cpp
+++ b/src/gallium/drivers/swr/swr_screen.cpp
@@ -1130,7 +1130,6 @@ struct pipe_screen *
 swr_create_screen_internal(struct sw_winsys *winsys)
 {
    struct swr_screen *screen = CALLOC_STRUCT(swr_screen);
-   memset(screen, 0, sizeof(struct swr_screen));
 
    if (!screen)
       return NULL;
-- 
2.14.1



More information about the mesa-dev mailing list