changeset 2751:3411fb673d4b

Merged r4082:4083 from branches/SDL-1.2: sparc64 crash fix.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 08 Sep 2008 07:38:41 +0000
parents e3affc66d963
children edd2839b36f7
files src/video/Xext/Xxf86vm/XF86VMode.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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();