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

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

Issue 9333005: Fix some memory leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 months 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/heapcheck/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 81ae4911930b59e1c31862ce6bde56dcd95515a0..06e79079488b4e6e63d5175ceedcfa8954e50cef 100644
--- a/chrome/browser/chromeos/input_method/xkeyboard.cc
+++ b/chrome/browser/chromeos/input_method/xkeyboard.cc
@@ -264,20 +264,17 @@ unsigned int XKeyboardImpl::GetNumLockMask() {
const std::string string_to_find(kNumLockVirtualModifierString);
for (size_t i = 0; i < XkbNumVirtualMods; ++i) {
const unsigned int virtual_mod_mask = 1U << i;
- char* virtual_mod_str =
- XGetAtomName(xkb_desc->dpy, xkb_desc->names->vmods[i]);
- if (!virtual_mod_str) {
+ ui::XScopedString virtual_mod_str(
+ XGetAtomName(xkb_desc->dpy, xkb_desc->names->vmods[i]));
+ if (!virtual_mod_str.string())
continue;
- }
- if (string_to_find == virtual_mod_str) {
+ if (string_to_find == virtual_mod_str.string()) {
if (!XkbVirtualModsToReal(xkb_desc, virtual_mod_mask, &real_mask)) {
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/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698