Skip to content

Commit

Permalink
[Fix] More resource leaks & travis will build with ALSA and PulseAudi…
Browse files Browse the repository at this point in the history
…o support
  • Loading branch information
zeehio committed Aug 29, 2014
1 parent 3f50759 commit 01c1a3a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ language: cpp
matrix:
include:
- compiler: gcc
before_install: sudo pip install cpp-coveralls --use-mirrors
script: ./configure --enable-profile=gcov && make && make test
before_install:
- sudo pip install cpp-coveralls --use-mirrors
- sudo apt-get update -qq
- sudo apt-get install -y libasound2-dev libncurses5-dev libpulse-dev
script: ./configure --enable-profile=gcov --with-pulseaudio && make && make test
after_success: coveralls --exclude rxp --exclude testsuite --exclude java
branch_pattern: travis-ci
- compiler: gcc
Expand Down
7 changes: 5 additions & 2 deletions grammar/ngram/ngrammar_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,10 @@ load_ngram_cstr_bin(const EST_String filename, EST_Ngrammar &n)
}
if (SWAPINT(magic) == EST_NGRAMBIN_MAGIC)
swap = TRUE;
else if (magic != EST_NGRAMBIN_MAGIC)
return wrong_format;
else if (magic != EST_NGRAMBIN_MAGIC) {
fclose(ifd);
return wrong_format;
}
if (ts.open(ifd, FALSE) == -1)
return misc_read_error;

Expand Down Expand Up @@ -364,6 +366,7 @@ load_ngram_cstr_bin(const EST_String filename, EST_Ngrammar &n)
cerr << "EST_Ngrammar::load_ngram_cstr_bin format does not have expected number of entries" << endl;
ts.close();
fclose(ifd);
delete[] dd;
return misc_read_error;
}
if (swap)
Expand Down
2 changes: 1 addition & 1 deletion main/pitchmark_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static EST_write_status save_ogi_bin(EST_Track &pm, EST_String filename, int sr)
return misc_write_error;
}
delete[] d;

fclose(fp);
return write_ok;
}

Expand Down
4 changes: 4 additions & 0 deletions speech_class/EST_wave_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ enum EST_read_status load_wave_nist(EST_TokenStream &ts, short **data, int
wfree(tmpfile);
wfree(cmdstr);
tt.close();
wfree(byte_order);
wfree(sample_coding);
return rval;
}

Expand Down Expand Up @@ -1658,6 +1660,7 @@ enum EST_read_status load_wave_sd(EST_TokenStream &ts, short **data, int
*bo = EST_NATIVE_BO;
*word_size = 2;
delete_esps_hdr(hdr);
wfree(hdr);
return format_ok;

}
Expand Down Expand Up @@ -1686,6 +1689,7 @@ enum EST_write_status save_wave_sd_header(FILE *fp,
fprintf(stderr,"ESPS file: no support for sample_type %s\n",
sample_type_to_str(sample_type));
delete_esps_hdr(hdr);
wfree(hdr);
return misc_write_error;
}
/* I believe all of the following are necessary and in this order */
Expand Down

0 comments on commit 01c1a3a

Please sign in to comment.