Skip to content

Commit

Permalink
simulator and dumpfile fix minor resource leaks
Browse files Browse the repository at this point in the history
 * Certain conditional branches returned before closing the file handler.
  • Loading branch information
ptrks authored and dagar committed Sep 9, 2019
1 parent a5e6c88 commit 47e668e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/modules/simulator/simulator_mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ void Simulator::poll_for_MAVLink_messages()

if (bind(_fd, (struct sockaddr *)&_myaddr, sizeof(_myaddr)) < 0) {
PX4_ERR("bind for UDP port %i failed (%i)", _port, errno);
::close(_fd);
return;
}

Expand Down
1 change: 1 addition & 0 deletions src/systemcmds/dumpfile/dumpfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ dumpfile_main(int argc, char *argv[])

if (tcsetattr(out, TCSANOW, &tc) < 0) {
PX4_ERR("failed setting stdout attributes");
fclose(f);
return 1;
}

Expand Down

0 comments on commit 47e668e

Please sign in to comment.