From 2b31329ac6d96aae6fb23d3e23949fb50c478b06 Mon Sep 17 00:00:00 2001 From: Manuel Domke Date: Fri, 27 Jul 2018 09:09:29 +0200 Subject: [PATCH] fix --list-devices --- software/libinfnoise.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/software/libinfnoise.c b/software/libinfnoise.c index e95d18a..1dc0e94 100644 --- a/software/libinfnoise.c +++ b/software/libinfnoise.c @@ -231,13 +231,15 @@ devlist_node listUSBDevices(char **message) { strcpy(current_entry->serial, serial); strcpy(current_entry->manufacturer, manufacturer); strcpy(current_entry->description, description); - current_entry->next = malloc(sizeof(struct infnoise_devlist_node)); - current_entry = current_entry->next; - + if (curdev->next) { + current_entry->next = malloc(sizeof(struct infnoise_devlist_node)); + current_entry = current_entry->next; + } else { + current_entry->next = NULL; + } //printf("debug: Manufacturer: %s, Description: %s, Serial: %s\n", manufacturer, description, serial); curdev = curdev->next; } - current_entry = NULL; return return_list; }