diff options
author | Gregory Maxwell <greg@xiph.org> | 2011-10-30 07:54:45 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2011-10-30 08:02:28 +0400 |
commit | 38fc0d59bcad2846b59f21d0cc308e43ea9545b2 (patch) | |
tree | aa7eef082d9eda6b9284fa4c69bbdc345a24dbb7 /src | |
parent | a44e95abd0b6892401f1525cf1cd5590f93277de (diff) |
Fix some inconsequential file descriptor leaks in the demo tools to silence cppcheck warnings.
Diffstat (limited to 'src')
-rw-r--r-- | src/opus_demo.c | 9 | ||||
-rw-r--r-- | src/repacketizer_demo.c | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/opus_demo.c b/src/opus_demo.c index 23c2128f..e1884f37 100644 --- a/src/opus_demo.c +++ b/src/opus_demo.c @@ -312,6 +312,7 @@ int main(int argc, char *argv[]) if (!fout) { fprintf (stderr, "Could not open output file %s\n", argv[argc-1]); + fclose(fin); return EXIT_FAILURE; } @@ -321,6 +322,8 @@ int main(int argc, char *argv[]) if (err != OPUS_OK) { fprintf(stderr, "Cannot create encoder: %s\n", opus_strerror(err)); + fclose(fin); + fclose(fout); return EXIT_FAILURE; } opus_encoder_ctl(enc, OPUS_SET_BITRATE(bitrate_bps)); @@ -341,6 +344,8 @@ int main(int argc, char *argv[]) if (err != OPUS_OK) { fprintf(stderr, "Cannot create decoder: %s\n", opus_strerror(err)); + fclose(fin); + fclose(fout); return EXIT_FAILURE; } } @@ -434,6 +439,8 @@ int main(int argc, char *argv[]) if (len[toggle] < 0) { fprintf (stderr, "opus_encode() returned %d\n", len[toggle]); + fclose(fin); + fclose(fout); return EXIT_FAILURE; } } @@ -485,6 +492,8 @@ int main(int argc, char *argv[]) (long)count, (unsigned long)enc_final_range[toggle^use_inbandfec], (unsigned long)dec_final_range); + fclose(fin); + fclose(fout); return EXIT_FAILURE; } diff --git a/src/repacketizer_demo.c b/src/repacketizer_demo.c index 6554c8cb..9a93df53 100644 --- a/src/repacketizer_demo.c +++ b/src/repacketizer_demo.c @@ -72,6 +72,7 @@ int main(int argc, char *argv[]) if(fout==NULL) { fprintf(stderr, "Error opening output file: %s\n", argv[argc-1]); + fclose(fin); return 1; } @@ -94,6 +95,8 @@ int main(int argc, char *argv[]) eof = 1; } else { fprintf(stderr, "Invalid payload length\n"); + fclose(fin); + fclose(fout); return 1; } break; |