mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
Merge pull request #1435 from tridge/pullrequest-fix-stream-leak
mixer: fixed stream handle leakage
This commit is contained in:
@@ -91,6 +91,7 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen)
|
|||||||
/* if the line is too long to fit in the buffer, bail */
|
/* if the line is too long to fit in the buffer, bail */
|
||||||
if ((strlen(line) + strlen(buf) + 1) >= maxlen) {
|
if ((strlen(line) + strlen(buf) + 1) >= maxlen) {
|
||||||
warnx("line too long");
|
warnx("line too long");
|
||||||
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +99,7 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen)
|
|||||||
strcat(buf, line);
|
strcat(buf, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user