From 3763cb0badead6d6dd6f473e94e36b0895d405a3 Mon Sep 17 00:00:00 2001 From: Kano Date: Mon, 25 Jun 2012 23:16:07 +1000 Subject: [PATCH] icarus - must allows allocate memory for icarus_info --- driver-icarus.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/driver-icarus.c b/driver-icarus.c index 4d8ac532..442eb9d1 100644 --- a/driver-icarus.c +++ b/driver-icarus.c @@ -426,11 +426,10 @@ static bool icarus_detect_one(const char *devpath) applog(LOG_INFO, "Found Icarus at %s, mark as %d", devpath, icarus->device_id); - if (icarus_info[icarus->device_id] == NULL) { - icarus_info[icarus->device_id] = (struct ICARUS_INFO *)malloc(sizeof(struct ICARUS_INFO)); - if (unlikely(!(icarus_info[icarus->device_id]))) - quit(1, "Failed to malloc ICARUS_INFO"); - } + // Since we are adding a new device on the end it needs to always be allocated + icarus_info[icarus->device_id] = (struct ICARUS_INFO *)malloc(sizeof(struct ICARUS_INFO)); + if (unlikely(!(icarus_info[icarus->device_id]))) + quit(1, "Failed to malloc ICARUS_INFO"); info = icarus_info[icarus->device_id];