summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-08-13 15:00:14 -0700
committerKeith Packard <keithp@keithp.com>2011-08-13 18:44:26 -0700
commit3b87dd6f46922cf5f98deb2dffa2148c4244e48e (patch)
tree3d183fcfda9d3f99334c2fe0b9bb11b0a80e6a32
parent640422c028a2be898aa3a9048a0f6fad2e43dd8d (diff)
ao-tools: ao-list was crashing with more than 3 devices connected
the list of devices was getting realloced for each new device, but that realloc was too small. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--ao-tools/lib/cc-usbdev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ao-tools/lib/cc-usbdev.c b/ao-tools/lib/cc-usbdev.c
index afa91d49..a19e231c 100644
--- a/ao-tools/lib/cc-usbdev.c
+++ b/ao-tools/lib/cc-usbdev.c
@@ -223,7 +223,7 @@ cc_usbdevs_scan(void)
if (dev->idVendor == 0xfffe && dev->tty) {
if (devs->dev)
devs->dev = realloc(devs->dev,
- devs->ndev + 1 * sizeof (struct usbdev *));
+ (devs->ndev + 1) * sizeof (struct usbdev *));
else
devs->dev = malloc (sizeof (struct usbdev *));
devs->dev[devs->ndev++] = dev;