Bug 653 bugfix
authorSzymon Wilczek <kazeuser@gmail.com>
Sat, 03 Jan 2009 12:00:20 +0000
changeset 2980 8789e4b0e0e7
parent 2979 d578ae900755
child 2981 4bbb9de56029
Bug 653 bugfix
src/video/win32/SDL_win32mouse.c
--- 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);