aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-25 22:45:55 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-25 22:49:04 -0300
commitb6e89ace327351c3f7b4da7205f1641fea959a8f (patch)
tree369e8dbea0aebc9cbe11ff8ca63f9ac6175b8118
parent55cc68eebcac0e138abaadb9c1a43e5eb59d4335 (diff)
dvb-file: fix memory-deallocation bug
channel should be a pointer, as it will be allocated internally, otherwise we'll have a double de-allocation when freeing DVB scan structures. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--lib/libdvbv5/dvb-file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 8df348eb..326871d2 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -1022,12 +1022,12 @@ static int get_program_and_store(struct dvb_v5_fe_parms *parms,
entry->props[j].cmd = parms->dvb_prop[j].cmd;
entry->props[j].u.data = parms->dvb_prop[j].u.data;
- if (!channel && entry->props[j].cmd == DTV_FREQUENCY)
+ if (!*channel && entry->props[j].cmd == DTV_FREQUENCY)
freq = parms->dvb_prop[j].u.data;
}
entry->n_props = parms->n_props;
- if (!channel) {
+ if (!*channel) {
r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
if (r < 0)
dvb_perror("asprintf");
@@ -1113,8 +1113,9 @@ int store_dvb_channel(struct dvb_file **dvb_file,
if (!dvb_scan_handler->sdt) {
int i;
- dvb_logerr("no SDT table - storing channels without their names");
+ dvb_log("WARNING: no SDT table - storing channels without their names");
for (i = 0; i < dvb_scan_handler->num_program; i++) {
+ char *channel = NULL;
unsigned service_id;
if (!dvb_scan_handler->program[i].pmt)
@@ -1123,7 +1124,7 @@ int store_dvb_channel(struct dvb_file **dvb_file,
service_id = dvb_scan_handler->program[i].pat_pgm->service_id;
rc = get_program_and_store(parms, *dvb_file, dvb_scan_handler,
- service_id, NULL, NULL,
+ service_id, channel, NULL,
get_detected, get_nit);
if (rc < 0)
return rc;

Privacy Policy