Merged r4082:4083 from branches/SDL-1.2: sparc64 crash fix.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 08 Sep 2008 07:38:41 +0000
changeset 2751 3411fb673d4b
parent 2750 e3affc66d963
child 2752 edd2839b36f7
Merged r4082:4083 from branches/SDL-1.2: sparc64 crash fix.
src/video/Xext/Xxf86vm/XF86VMode.c
--- a/src/video/Xext/Xxf86vm/XF86VMode.c	Sat Sep 06 04:31:34 2008 +0000
+++ b/src/video/Xext/Xxf86vm/XF86VMode.c	Mon Sep 08 07:38:41 2008 +0000
@@ -210,6 +210,13 @@
     return True;
 }
 
+/* this is to prevent an unaligned memory write on CPUs that need that. */
+static void
+zap_ptr(char *ptr, size_t size)
+{
+    memset(ptr, '\0', size);
+}
+
 Bool SDL_NAME(XF86VidModeGetModeLine) (dpy, screen, dotclock, modeline)
      Display *
          dpy;
@@ -285,7 +292,7 @@
         _XRead(dpy, (char *) modeline->private,
                modeline->privsize * sizeof(INT32));
     } else {
-        modeline->private = NULL;
+        zap_ptr((char *)&modeline->private, sizeof(modeline->private))
     }
     UnlockDisplay(dpy);
     SyncHandle();