tools:iio: free channel-array completely

In iio_utils.c build_channel_array() dynamically allocates the string
generic_name in the current iio_channel_info, which doesn't got freed in
case of an error.
This dynamically allocated channel-array is used by generic_buffer, and
needs to be freed on the error/exit path.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index f879ad7..6daf98f 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -410,8 +410,10 @@
 	return 0;
 
 error_cleanup_array:
-	for (i = count - 1;  i >= 0; i--)
+	for (i = count - 1;  i >= 0; i--) {
 		free((*ci_array)[i].name);
+		free((*ci_array)[i].generic_name);
+	}
 	free(*ci_array);
 error_close_dir:
 	closedir(dp);