glut: Prevent potential double free in menuVisualSetup.
authorVinson Lee <vlee@vmware.com>
Sun, 13 Dec 2009 05:46:13 +0000 (21:46 -0800)
committerVinson Lee <vlee@vmware.com>
Sun, 13 Dec 2009 05:46:13 +0000 (21:46 -0800)
src/glut/glx/glut_menu.c

index 4c4a5ae7503e4f8ea6ed82e17cd1c76a5a0a6f8a..d136823c54f0dbc798b2d987a68c8779dd2ae413 100644 (file)
@@ -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;