Skip to content
Snippets Groups Projects
Commit 044f938b authored by Ruben Otto's avatar Ruben Otto :crab:
Browse files

fix: fix daemon memory leak

parent f2b03689
No related branches found
No related tags found
No related merge requests found
......@@ -86,24 +86,19 @@ int main() {
sigaction(SIGINT, &signal_action, NULL);
while (1) {
measurement_t *measurement = malloc(sizeof(measurement_t));
measurement_t measurement;
if (measurement == NULL) {
perror("Failed to allocate memory for measurement message");
return EXIT_FAILURE;
}
if (recv_userspace_message(&userspace_receive_handle, measurement) != 0) {
if (recv_userspace_message(&userspace_receive_handle, &measurement) != 0) {
continue;
}
printf("Received data from %d: ", measurement->id);
print_measurement_data(measurement);
printf("Received data from %d: ", measurement.id);
print_measurement_data(&measurement);
data_t data = {
.sender_id = SENDER_ID,
.count = 1,
.measurements = measurement,
.measurements = &measurement,
};
if (send_kernel_message(&kernel_send_handle, &data) == -1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment