Skip to content

Commit

Permalink
mavlink_stream: update fd list after changing interval
Browse files Browse the repository at this point in the history
The fd list was no longer in sync -> a stale descriptor was used for
polling -> causes memory leak
  • Loading branch information
pussuw committed May 13, 2024
1 parent c43c863 commit d9720d8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modules/mavlink/mavlink_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,13 @@ MavlinkStreamPoll::set_interval(uint16_t stream_id, int interval_ms)
}
}

// Update fds
for (int j = 0; j < _count; j++) {
_fds[j].fd = _orbs[j].fd;
_fds[j].events = POLLIN;
_fds[j].revents = 0;
}

pthread_mutex_unlock(&_mtx);
return PX4_OK;
}
Expand Down

0 comments on commit d9720d8

Please sign in to comment.