Skip to content

Commit

Permalink
Fix memory leak that's been there for 5 years but nobody noticed unti…
Browse files Browse the repository at this point in the history
…l now :) Fixes #3.
  • Loading branch information
speps committed Apr 9, 2014
1 parent 13b2e16 commit b169811
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions XInputDotNetPure/GamePad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public static GamePadState GetState(PlayerIndex playerIndex, GamePadDeadZone dea
IntPtr gamePadStatePointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GamePadState.RawState)));
uint result = Imports.XInputGamePadGetState((uint)playerIndex, gamePadStatePointer);
GamePadState.RawState state = (GamePadState.RawState)Marshal.PtrToStructure(gamePadStatePointer, typeof(GamePadState.RawState));
Marshal.FreeHGlobal(gamePadStatePointer);
return new GamePadState(result == Utils.Success, state, deadZone);
}

Expand Down

0 comments on commit b169811

Please sign in to comment.