diff src/video/win32/SDL_win32mouse.c @ 2980:8789e4b0e0e7

Bug 653 bugfix
author Szymon Wilczek <kazeuser@gmail.com>
date Sat, 03 Jan 2009 12:00:20 +0000
parents d2f68ec8c1d0
children 502adab079a4
line wrap: on
line diff
--- a/src/video/win32/SDL_win32mouse.c	Sat Jan 03 07:33:42 2009 +0000
+++ b/src/video/win32/SDL_win32mouse.c	Sat Jan 03 12:00:20 2009 +0000
@@ -85,7 +85,7 @@
             continue;
         }
         buffer = SDL_malloc((tmp + 1) * sizeof(char));
-        key_name = SDL_malloc(tmp + sizeof(reg_key_root) * sizeof(char));
+        key_name = SDL_malloc((tmp + SDL_strlen(reg_key_root) + 1) * sizeof(char));
 
         /* we're getting the device registry path and polishing it to get it's name,
            surely there must be an easier way, but we haven't found it yet */
@@ -125,6 +125,9 @@
                 }
             }
         }
+
+		buffer -= 4;
+
         if (is_rdp == 1) {
             SDL_free(buffer);
             SDL_free(key_name);