mpegts mux dvb: fix the load sequence and possible memory leak

This commit is contained in:
Jaroslav Kysela 2015-01-27 12:22:42 +01:00
parent 3c0a279825
commit c664af6f60

View file

@ -649,11 +649,20 @@ dvb_mux_create0
}
/* Create */
if (!(mm = mpegts_mux_create0(calloc(1, sizeof(dvb_mux_t)), idc, uuid,
(mpegts_network_t*)ln, onid, tsid, conf)))
return NULL;
mm = calloc(1, sizeof(dvb_mux_t));
lm = (dvb_mux_t*)mm;
/* Defaults */
lm->lm_tuning.dmc_fe_inversion = DVB_INVERSION_AUTO;
lm->lm_tuning.dmc_fe_pilot = DVB_PILOT_AUTO;
/* Parent init and load config */
if (!(mm = mpegts_mux_create0(mm, idc, uuid,
(mpegts_network_t*)ln, onid, tsid, conf))) {
free(mm);
return NULL;
}
/* Tuning */
if (dmc)
memcpy(&lm->lm_tuning, dmc, sizeof(dvb_mux_conf_t));
@ -665,12 +674,6 @@ dvb_mux_create0
lm->mm_config_save = dvb_mux_config_save;
lm->mm_create_instances = dvb_mux_create_instances;
/* Defaults */
if (dmc == NULL) {
lm->lm_tuning.dmc_fe_inversion = DVB_INVERSION_AUTO;
lm->lm_tuning.dmc_fe_pilot = DVB_PILOT_AUTO;
}
/* No config */
if (!conf) return lm;