[PATCH xf86-input-synaptics 1/6] Allocate axis labels array dynamically
Chase Douglas
chase.douglas at canonical.com
Thu Jan 19 13:05:46 PST 2012
Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
src/synaptics.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/src/synaptics.c b/src/synaptics.c
index b1f2cf2..1c68358 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -993,13 +993,20 @@ DeviceInit(DeviceIntPtr dev)
int min, max;
int num_axes = 2;
Atom btn_labels[SYN_MAX_BUTTONS] = { 0 };
- Atom axes_labels[4] = { 0 };
+ Atom *axes_labels;
DeviceVelocityPtr pVel;
#ifdef HAVE_SMOOTH_SCROLL
num_axes += 2;
#endif
+ axes_labels = calloc(num_axes, sizeof(Atom));
+ if (!axes_labels)
+ {
+ xf86IDrvMsg(pInfo, X_ERROR, "failed to allocate axis labels\n");
+ return !Success;
+ }
+
InitAxesLabels(axes_labels, num_axes);
InitButtonLabels(btn_labels, SYN_MAX_BUTTONS);
@@ -1104,6 +1111,9 @@ DeviceInit(DeviceIntPtr dev)
xf86InitValuatorAxisStruct(dev, 3, axes_labels[3], 0, -1, 0, 0, 0,
Relative);
priv->scroll_axis_vert = 3;
+
+ free(axes_labels);
+
priv->scroll_events_mask = valuator_mask_new(MAX_VALUATORS);
if (!priv->scroll_events_mask)
return !Success;
--
1.7.8.3
More information about the xorg-devel
mailing list