forked from Archive/PX4-Autopilot
simulator and dumpfile fix minor resource leaks
* Certain conditional branches returned before closing the file handler.
This commit is contained in:
parent
a5e6c880fe
commit
47e668eb86
|
@ -673,6 +673,7 @@ void Simulator::poll_for_MAVLink_messages()
|
||||||
|
|
||||||
if (bind(_fd, (struct sockaddr *)&_myaddr, sizeof(_myaddr)) < 0) {
|
if (bind(_fd, (struct sockaddr *)&_myaddr, sizeof(_myaddr)) < 0) {
|
||||||
PX4_ERR("bind for UDP port %i failed (%i)", _port, errno);
|
PX4_ERR("bind for UDP port %i failed (%i)", _port, errno);
|
||||||
|
::close(_fd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ dumpfile_main(int argc, char *argv[])
|
||||||
|
|
||||||
if (tcsetattr(out, TCSANOW, &tc) < 0) {
|
if (tcsetattr(out, TCSANOW, &tc) < 0) {
|
||||||
PX4_ERR("failed setting stdout attributes");
|
PX4_ERR("failed setting stdout attributes");
|
||||||
|
fclose(f);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue