svga: Prevent use after free.
authorJose Fonseca <jfonseca@vmware.com>
Mon, 22 Jan 2018 15:05:22 +0000 (15:05 +0000)
committerJose Fonseca <jfonseca@vmware.com>
Mon, 22 Jan 2018 21:12:41 +0000 (21:12 +0000)
Courtesy of clang static analyzer.

I was hunting for potential sources of memory corruption using Mesa with
a GL trace, and happened to find this (unrelated) issue.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
src/gallium/drivers/svga/svga_context.c

index 546b9f48b135575850b3a0fd3c1356f0507738e5..af16a99b72cc36ae1a9b8230eff4f41af8dc2cdd 100644 (file)
@@ -327,6 +327,7 @@ cleanup:
    util_bitmask_destroy(svga->stream_output_id_bm);
    util_bitmask_destroy(svga->query_id_bm);
    FREE(svga);
+   svga = NULL;
 
 done:
    SVGA_STATS_TIME_POP(svgascreen->sws);