swr: Remove unnecessary memset call
authorVlad Golovkin <vlad.golovkin.mail@gmail.com>
Wed, 1 Aug 2018 17:56:23 +0000 (20:56 +0300)
committerEric Engestrom <eric.engestrom@intel.com>
Thu, 2 Aug 2018 10:13:40 +0000 (11:13 +0100)
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.

Fixes: a29d63ecf71546c4798c6 "swr: refactor swr_create_screen to allow
                              for proper cleanup on error"
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/gallium/drivers/swr/swr_screen.cpp

index fa232b6838bb401b9c22362b9845ef8337a3fc81..67085444f845879d624762a43afb55599a10f464 100644 (file)
@@ -1148,7 +1148,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;