From: Keith Packard Date: Sat, 13 Aug 2011 22:00:14 +0000 (-0700) Subject: ao-tools: ao-list was crashing with more than 3 devices connected X-Git-Tag: 0.9.6.0~24 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=3b87dd6f46922cf5f98deb2dffa2148c4244e48e 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 --- 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;