/** get writable buffer */
mem = gst_buffer_peek_memory (buffer, 0);
g_assert (gst_memory_map (mem, &map, GST_MAP_WRITE));
+ /** memory to data from file */
+ bytes_to_read = self->scan_size * self->buffer_capacity;
+ raw_data_base = g_malloc (bytes_to_read);
/** wait for the data to arrive */
time_to_end = g_get_real_time () + self->poll_timeout * 1000;
}
}
- /** read the data from file */
- bytes_to_read = self->scan_size * self->buffer_capacity;
- raw_data_base = g_malloc (bytes_to_read);
/** using read for non-blocking access */
status = read (self->buffer_data_fp->fd, raw_data_base, bytes_to_read);
if (status < bytes_to_read) {
data_size = num_bytes * iio_dev->num_scan_elements / skip;
scan_el_data = (char *) malloc (data_size);
+ if (scan_el_data == NULL) {
+ return -1;
+ }
/** total 8 possible cases */
for (int idx = 0; idx < iio_dev->num_scan_elements; idx++) {
enabled = (idx % skip == 0);
case 8:
CHANGE_ENDIANNESS (64);
default:
+ {
+ g_free (scan_el_data);
return -1;
+ }
};
}
}
EXPECT_STREQ (expect_val_char, actual_val_char); \
g_free (actual_val_char); \
} \
+ g_free (expect_val_char); \
close (fd); \
free (data_buffer); \
\
EXPECT_STREQ (expect_val_char, actual_val_char);
g_free (actual_val_char);
}
+ g_free (expect_val_char);
close (fd);
free (data_buffer);
ASSERT_EQ (safe_remove (dev0->log_file), 0);
EXPECT_STREQ (expect_val_char, actual_val_char);
g_free (actual_val_char);
}
+ g_free (expect_val_char);
close (fd);
free (data_buffer);
ASSERT_EQ (safe_remove (dev0->log_file), 0);