Commit 5961f356 authored by Ghislain MARY's avatar Ghislain MARY

Fix buffer overflows and memory leaks.

parent 8fc51ef9
......@@ -351,7 +351,7 @@ static int volume_set_ea_sustain(MSFilter *f, void *arg){
static int volume_enable_noise_gate(MSFilter *f, void *arg){
Volume *v=(Volume*)f->data;
v->noise_gate_enabled=*(int*)arg;
v->noise_gate_enabled=*(bool_t*)arg;
if (v->noise_gate_enabled){
v->gain = v->target_gain = v->ng_floorgain; // start with floorgain (soft start)
}
......
......@@ -995,6 +995,7 @@ void ms_factory_destroy(MSFactory *factory) {
factory->platform_tags = bctbx_list_free(factory->platform_tags);
if (factory->echo_canceller_filtername) ms_free(factory->echo_canceller_filtername);
if (factory->plugins_dir) ms_free(factory->plugins_dir);
if (factory->image_resources_dir) ms_free(factory->image_resources_dir);
ms_free(factory);
if (factory == fallback_factory) fallback_factory = NULL;
}
......
......@@ -663,8 +663,10 @@ static void mu_law_module_get_private_data(const void *o, uint8_t **data, size_t
}
static void mu_law_module_load_private(void *o, const uint8_t *data, size_t size) {
WavPrivate *obj = (WavPrivate *)o;
wav_private_load(obj, data);
if (size > 0) {
WavPrivate *obj = (WavPrivate *)o;
wav_private_load(obj, data);
}
}
/* µLaw module description */
......
......@@ -426,6 +426,8 @@ static void loss_rate_estimation_bv16(void){
LossRateEstimatorCtx ctx;
stream_manager_t * marielle, * margaux;
int loss_rate = 15;
char *plc_filename;
char *no_plc_filename;
for (plc_disabled = 0; plc_disabled <=1; plc_disabled++){
start_adaptive_stream(MSAudio, &marielle, &margaux, BV16_PAYLOAD_TYPE, 8000, 0, (float)loss_rate, 0, 0.0f, (bool_t)plc_disabled);
......@@ -442,8 +444,12 @@ static void loss_rate_estimation_bv16(void){
ortp_ev_queue_destroy(ctx.q);
}
/*file without plc must be approx 15% smaller in size than with plc */
size_with_plc= fsize(bc_tester_file(RECORDED_16K_1S_FILE));
size_no_plc = fsize(bc_tester_file(RECORDED_16K_1S_NO_PLC_FILE));
plc_filename = bc_tester_file(RECORDED_16K_1S_FILE);
size_with_plc= fsize(plc_filename);
bctbx_free(plc_filename);
no_plc_filename = bc_tester_file(RECORDED_16K_1S_NO_PLC_FILE);
size_no_plc = fsize(no_plc_filename);
bctbx_free(no_plc_filename);
result = (size_with_plc*loss_rate/100 + size_no_plc) ;
BC_ASSERT_GREATER(result, size_with_plc, int, "%d");
......
......@@ -110,6 +110,7 @@ static void create_text_stream(text_stream_tester_t *tst, int payload_type) {
}
static void destroy_text_stream(text_stream_tester_t *tst) {
ortp_ev_queue_destroy(tst->stats.q);
text_stream_stop(tst->ts);
}
......@@ -125,6 +126,7 @@ static void real_time_text_character_received(void *userdata, struct _MSFilter *
ms_fatal("tst->stats.received_chars buffer overflow (number_of_received_char=%i)",
tst->stats.number_of_received_char);
}
ms_free(data);
}
}
}
......
......@@ -406,6 +406,9 @@ static void basic_video_stream_base(int payload_type) {
video_stream_get_local_rtp_stats(margaux->vs, &margaux->stats.rtp);
uninit_video_streams(marielle, margaux);
video_stream_tester_destroy(margaux);
video_stream_tester_destroy(marielle);
}
static void basic_video_stream_vp8(void) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment