LOG_DEBUG("device path has %i steps", path_len);
- ptr = strtok(loc, ":");
+ ptr = strtok(loc, "-:");
if (ptr == NULL) {
LOG_DEBUG("no ':' in path");
goto done;
path_step = 0;
while (path_step < 7) {
- ptr = strtok(NULL, ",");
+ ptr = strtok(NULL, ".,");
if (ptr == NULL) {
LOG_DEBUG("no more tokens in path at step %i", path_step);
break;
ctx->write_size = 16384;
ctx->read_chunk = malloc(ctx->read_chunk_size);
ctx->read_buffer = malloc(ctx->read_size);
- ctx->write_buffer = malloc(ctx->write_size);
+
+ /* Use calloc to make valgrind happy: buffer_write() sets payload
+ * on bit basis, so some bits can be left uninitialized in write_buffer.
+ * Although this is perfectly ok with MPSSE, valgrind reports
+ * Syscall param ioctl(USBDEVFS_SUBMITURB).buffer points to uninitialised byte(s) */
+ ctx->write_buffer = calloc(1, ctx->write_size);
+
if (!ctx->read_chunk || !ctx->read_buffer || !ctx->write_buffer)
goto error;