diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2012-01-19 13:05:46 -0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-01-26 15:47:19 +1000 |
commit | 7ef9150d832d6ede991c5def02d2964c8047ad4f (patch) | |
tree | c19cc1359af2655a0a555fa84fc19ec597d89dd9 | |
parent | 3804a0ee0bec455fcc61a469dd907738ff5589bd (diff) |
Allocate axis labels array dynamically
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | 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; |