shortcut_catcher: memory leak fixes

memory allocated in get_key_map(..) wasn't released.

CID 5696, CID 5697, CID 1699, CID 1700
This commit is contained in:
Philippe Saint-Pierre 2012-01-07 20:42:19 -05:00
parent a5a013ca40
commit 74983a5f69
2 changed files with 6 additions and 1 deletions

View File

@ -797,6 +797,8 @@ KeyStrokeSequenceCommandActuator::_GenerateKeyCodes()
_SetStateBit(states, overrideKey); _SetStateBit(states, overrideKey);
} }
} }
free(keys);
free(map);
} }

View File

@ -11,6 +11,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
@ -102,7 +103,7 @@ static const char*
FindSpecialKeyLabelFor(uint8 keyCode, int& last) FindSpecialKeyLabelFor(uint8 keyCode, int& last)
{ {
while ((keyLabels[last].fKeyCode < keyCode) while ((keyLabels[last].fKeyCode < keyCode)
&& (last < (sizeof(keyLabels)/sizeof(struct KeyLabelMap))-1)) && (last < (sizeof(keyLabels) / sizeof(struct KeyLabelMap)) - 1))
last++; last++;
if (keyLabels[last].fKeyCode == keyCode) if (keyLabels[last].fKeyCode == keyCode)
@ -151,6 +152,8 @@ InitKeyIndices()
} else } else
utfDescriptions[j * MAX_UTF8_LENGTH] = 0x00; utfDescriptions[j * MAX_UTF8_LENGTH] = 0x00;
} }
free(keys);
free(map);
} }