From: tskd08@gmail.com
To: linux-media@vger.kernel.org
Cc: m.chehab@samsung.com, Akihiro Tsukada <tskd08@gmail.com>
Subject: [PATCH v2 1/7] v4l-utils/libdvbv5: fix auto generation of channel names
Date: Sun, 26 Oct 2014 20:46:17 +0900 [thread overview]
Message-ID: <1414323983-15996-2-git-send-email-tskd08@gmail.com> (raw)
In-Reply-To: <1414323983-15996-1-git-send-email-tskd08@gmail.com>
From: Akihiro Tsukada <tskd08@gmail.com>
when channel name was not available, it was generated from unset variables,
and leaked memory.
---
lib/libdvbv5/dvb-file.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 27d9a63..1ea14c4 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -1121,20 +1121,23 @@ static int get_program_and_store(struct dvb_v5_fe_parms_priv *parms,
if (rc)
dvb_logerr("Couldn't get frontend props");
}
+ for (j = 0; j < parms->n_props; j++) {
+ entry->props[j].cmd = parms->dvb_prop[j].cmd;
+ entry->props[j].u.data = parms->dvb_prop[j].u.data;
+
+ if (!*channel)
+ freq = entry->props[j].u.data;
+ }
if (!*channel) {
- r = asprintf(&channel, "%.2fMHz#%d", freq/1000000., service_id);
+ free(channel);
+ r = asprintf(&channel, "%.2f%cHz#%d", freq / 1000000.,
+ dvb_fe_is_satellite(parms->p.current_sys) ? 'G' : 'M',
+ service_id);
if (r < 0)
dvb_perror("asprintf");
if (parms->p.verbose)
dvb_log("Storing as: '%s'", channel);
}
- for (j = 0; j < parms->n_props; j++) {
- 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)
- freq = parms->dvb_prop[j].u.data;
- }
entry->n_props = parms->n_props;
entry->channel = channel;
@@ -1225,12 +1228,19 @@ int dvb_store_channel(struct dvb_file **dvb_file,
continue;
service_id = dvb_scan_handler->program[i].pat_pgm->service_id;
+ rc = asprintf(&channel, "#%d", service_id);
+ if (rc < 0) {
+ dvb_perror("asprintf");
+ return rc;
+ }
rc = get_program_and_store(parms, *dvb_file, dvb_scan_handler,
service_id, channel, NULL,
get_detected, get_nit);
- if (rc < 0)
+ if (rc < 0) {
+ free(channel);
return rc;
+ }
}
return 0;
--
2.1.2
next prev parent reply other threads:[~2014-10-26 11:47 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-26 11:46 [PATCH v2 0/7] v4l-utils/libdvbv5,dvb: add support for ISDB-S tskd08
2014-10-26 11:46 ` tskd08 [this message]
2014-10-27 14:01 ` [PATCH v2 1/7] v4l-utils/libdvbv5: fix auto generation of channel names Mauro Carvalho Chehab
2014-10-27 14:31 ` Mauro Carvalho Chehab
2014-10-26 11:46 ` [PATCH v2 2/7] v4l-utils/libdvbv5: add support for ISDB-S tuning tskd08
2014-10-27 14:38 ` Mauro Carvalho Chehab
2014-10-26 11:46 ` [PATCH v2 3/7] v4l-utils/libdvbv5: add support for ISDB-S scanning tskd08
2014-10-27 14:46 ` Mauro Carvalho Chehab
2014-10-31 14:37 ` Akihiro TSUKADA
2014-10-31 19:53 ` Mauro Carvalho Chehab
2014-11-02 9:52 ` Akihiro TSUKADA
2014-10-26 11:46 ` [PATCH v2 4/7] v4l-utils/dvb: add COUNTRY property tskd08
2014-10-27 15:22 ` Mauro Carvalho Chehab
2014-10-26 11:46 ` [PATCH v2 5/7] v4l-utils/libdvbv5: add gconv module for the text translation of ISDB-S/T tskd08
2014-10-27 17:08 ` Mauro Carvalho Chehab
2014-10-31 15:02 ` Akihiro TSUKADA
2014-10-31 20:01 ` Mauro Carvalho Chehab
2014-10-26 11:46 ` [PATCH v2 6/7] v4l-utils/libdvbv5: don't discard config-supplied parameters tskd08
2014-10-27 17:11 ` Mauro Carvalho Chehab
2014-10-31 15:24 ` Akihiro TSUKADA
2014-10-31 20:02 ` Mauro Carvalho Chehab
2014-10-26 11:46 ` [PATCH v2 7/7] v4l-utils/libdvbv5, dvbv5-scan: generalize channel duplication check tskd08
2014-10-27 17:14 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414323983-15996-2-git-send-email-tskd08@gmail.com \
--to=tskd08@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).