Mesa (mesa_7_6_branch): glut: Prevent potential double free in menuVisualSetup.

Vinson Lee vlee at kemper.freedesktop.org
Sat Dec 12 21:47:59 PST 2009


Module: Mesa
Branch: mesa_7_6_branch
Commit: 89d85e8170e38e04790a2c10541dec01fee9afd2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=89d85e8170e38e04790a2c10541dec01fee9afd2

Author: Vinson Lee <vlee at vmware.com>
Date:   Sat Dec 12 21:46:13 2009 -0800

glut: Prevent potential double free in menuVisualSetup.

---

 src/glut/glx/glut_menu.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/glut/glx/glut_menu.c b/src/glut/glx/glut_menu.c
index 4c4a5ae..d136823 100644
--- a/src/glut/glx/glut_menu.c
+++ b/src/glut/glx/glut_menu.c
@@ -225,6 +225,7 @@ menuVisualSetup(void)
             if (!status) {
               XFreeColormap(__glutDisplay, menuColormap);
               free(placeHolders);
+              placeHolders = NULL;
               continue;
             }
           }
@@ -241,6 +242,7 @@ menuVisualSetup(void)
             XFreeColormap(__glutDisplay, menuColormap);
             if (placeHolders) {
               free(placeHolders);
+              placeHolders = NULL;
             }
             continue;
           }
@@ -252,6 +254,7 @@ menuVisualSetup(void)
             XFreeColormap(__glutDisplay, menuColormap);
             if (placeHolders) {
               free(placeHolders);
+              placeHolders = NULL;
             }
             continue;
           }
@@ -263,6 +266,7 @@ menuVisualSetup(void)
             XFreeColormap(__glutDisplay, menuColormap);
             if (placeHolders) {
               free(placeHolders);
+              placeHolders = NULL;
             }
             continue;
           }
@@ -271,6 +275,7 @@ menuVisualSetup(void)
             XFreeColors(__glutDisplay, menuColormap,
               placeHolders, numPlaceHolders, 0);
             free(placeHolders);
+            placeHolders = NULL;
           }
           menuWhite = color.pixel;
           menuVisual = visual->vinfo.visual;



More information about the mesa-commit mailing list