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

Kyriazis, George george.kyriazis at intel.com
Mon Apr 16 16:49:59 UTC 2018


Reviewed-By: George Kyriazis <george.kyriazis at intel.com<mailto:george.kyriazis at intel.com>>


On Apr 12, 2018, at 8:49 PM, Vlad Golovkin <vlad.golovkin.mail at gmail.com<mailto:vlad.golovkin.mail at gmail.com>> wrote:

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

_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org<mailto:mesa-dev at lists.freedesktop.org>
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180416/720d58e8/attachment.html>


More information about the mesa-dev mailing list