Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4047)

Unified Diff: chrome/browser/chromeos/input_method/xkeyboard.cc

Issue 8552001: Fix memory leak in xkeyboard.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/input_method/xkeyboard.cc
diff --git a/chrome/browser/chromeos/input_method/xkeyboard.cc b/chrome/browser/chromeos/input_method/xkeyboard.cc
index a810f3044d5c33180fad0cb99aef195522990c6c..95d1854faaca410e09a24a81b1ebd45aeb5c5ae2 100644
--- a/chrome/browser/chromeos/input_method/xkeyboard.cc
+++ b/chrome/browser/chromeos/input_method/xkeyboard.cc
@@ -159,7 +159,7 @@ unsigned int XKeyboard::GetNumLockMask() {
const std::string string_to_find(kNumLockVirtualModifierString);
for (size_t i = 0; i < XkbNumVirtualMods; ++i) {
const unsigned int virtual_mod_mask = 1U << i;
- const char* virtual_mod_str =
+ char* virtual_mod_str =
XGetAtomName(xkb_desc->dpy, xkb_desc->names->vmods[i]);
if (!virtual_mod_str) {
continue;
@@ -169,8 +169,10 @@ unsigned int XKeyboard::GetNumLockMask() {
LOG(ERROR) << "XkbVirtualModsToReal failed";
real_mask = kBadMask; // reset the return value, just in case.
}
+ XFree(virtual_mod_str);
break;
}
+ XFree(virtual_mod_str);
}
}
XkbFreeKeyboard(xkb_desc, 0, True /* free all components */);
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698