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

Unified Diff: ui/base/touch/touch_factory.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
Index: ui/base/touch/touch_factory.cc
diff --git a/ui/base/touch/touch_factory.cc b/ui/base/touch/touch_factory.cc
index b636ea05d7b444ccd651ee73b1a47fc592391a51..585b5882d89d77d87d37aa7af37479187092f995 100644
--- a/ui/base/touch/touch_factory.cc
+++ b/ui/base/touch/touch_factory.cc
@@ -64,9 +64,12 @@ XIValuatorClassInfo* FindTPValuator(Display* display,
reinterpret_cast<XIValuatorClassInfo*>(info->classes[i]);
if (v->label) {
- const char* atom = XGetAtomName(display, v->label);
- if (atom && strcmp(atom, atom_tp) == 0)
+ char* atom = XGetAtomName(display, v->label);
sky 2012/02/06 17:55:47 How about a scoping object?
sadrul 2012/02/06 19:48:30 Sounds good. Done.
+ if (atom && strcmp(atom, atom_tp) == 0) {
+ XFree(atom);
return v;
+ }
+ XFree(atom);
}
}
@@ -151,12 +154,13 @@ void TouchFactory::UpdateDeviceList(Display* display) {
XDeviceInfo* devlist = XListInputDevices(display, &count);
for (int i = 0; i < count; i++) {
if (devlist[i].type) {
- const char* devtype = XGetAtomName(display, devlist[i].type);
+ char* devtype = XGetAtomName(display, devlist[i].type);
if (devtype && !strcmp(devtype, XI_TOUCHSCREEN)) {
touch_device_lookup_[devlist[i].id] = true;
touch_device_list_[devlist[i].id] = true;
touch_device_available_ = true;
}
+ XFree(devtype);
}
}
if (devlist)

Powered by Google App Engine
This is Rietveld 408576698