src/video/win32/SDL_win32mouse.c
changeset 2980 8789e4b0e0e7
parent 2974 d2f68ec8c1d0
child 2990 502adab079a4
--- 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);